@@ -14,17 +14,15 @@ namespace SimpleDnsCrypt.ViewModels
1414 [ Export ( typeof ( QueryLogViewModel ) ) ]
1515 public class QueryLogViewModel : Screen
1616 {
17+ private static readonly ILog Log = LogManagerHelper . Factory ( ) ;
1718 private readonly IWindowManager _windowManager ;
1819 private readonly IEventAggregator _events ;
1920
20-
2121 private ObservableCollection < QueryLogLine > _queryLogLines ;
2222 private string _queryLogFile ;
2323 private bool _isQueryLogLogging ;
2424 private QueryLogLine _selectedQueryLogLine ;
2525
26-
27-
2826 [ ImportingConstructor ]
2927 public QueryLogViewModel ( IWindowManager windowManager , IEventAggregator events )
3028 {
@@ -196,17 +194,27 @@ await Task.Run(() =>
196194 }
197195 } ) . ConfigureAwait ( false ) ;
198196 else
199- IsQueryLogLogging = false ;
197+ _isQueryLogLogging = false ;
200198 else
201- IsQueryLogLogging = false ;
199+ _isQueryLogLogging = false ;
202200 }
203201 else
204202 {
203+ //disable query log again
204+ _isQueryLogLogging = false ;
205+ if ( DnsCryptProxyManager . IsDnsCryptProxyRunning ( ) )
206+ {
207+ dnscryptProxyConfiguration . query_log . file = null ;
208+ DnsCryptProxyManager . Restart ( ) ;
209+ await Task . Delay ( Global . ServiceRestartTime ) . ConfigureAwait ( false ) ;
210+ }
205211 Execute . OnUIThread ( ( ) => { QueryLogLines . Clear ( ) ; } ) ;
212+ Execute . OnUIThread ( ( ) => { QueryLogFile = string . Empty ; } ) ;
206213 }
207214 }
208- catch ( Exception )
215+ catch ( Exception exception )
209216 {
217+ Log . Error ( exception ) ;
210218 }
211219 }
212220 }
0 commit comments