From ee31cf06d4e071bd7e7ddd4b3fb8c0e32223dea0 Mon Sep 17 00:00:00 2001 From: Jakob Date: Sun, 9 Jul 2023 18:35:46 +0200 Subject: [PATCH] improve logging --- EnvyUpdate/InfoWindow.xaml.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/EnvyUpdate/InfoWindow.xaml.cs b/EnvyUpdate/InfoWindow.xaml.cs index 25c2f5d..6f369cb 100644 --- a/EnvyUpdate/InfoWindow.xaml.cs +++ b/EnvyUpdate/InfoWindow.xaml.cs @@ -34,17 +34,23 @@ namespace EnvyUpdate private void chkLog_Checked(object sender, RoutedEventArgs e) { - Debug.isVerbose = true; - Debug.LogToFile("------"); - Debug.LogToFile("INFO Enabled logging to file. Restart Application to see full startup log."); + if (!Debug.isVerbose) + { + Debug.isVerbose = true; + Debug.LogToFile("------"); + Debug.LogToFile("INFO Enabled logging to file. Restart Application to see full startup log."); + } } private void chkLog_Unchecked(object sender, RoutedEventArgs e) { - Debug.LogToFile("INFO Disabled logging to file."); - if (File.Exists(Path.Combine(GlobalVars.exedirectory, "envyupdate.log"))) - File.Move(Path.Combine(GlobalVars.exedirectory, "envyupdate.log"), Path.Combine(GlobalVars.exedirectory, "envyupdate." + DateTime.Now.ToString("yyyyMMdd-HHmmss") + ".log")); - Debug.isVerbose = false; + if (Debug.isVerbose) + { + Debug.LogToFile("INFO Disabled logging to file."); + if (File.Exists(Path.Combine(GlobalVars.exedirectory, "envyupdate.log"))) + File.Move(Path.Combine(GlobalVars.exedirectory, "envyupdate.log"), Path.Combine(GlobalVars.exedirectory, "envyupdate." + DateTime.Now.ToString("yyyyMMdd-HHmmss") + ".log")); + Debug.isVerbose = false; + } } } }