improve logging

This commit is contained in:
Jakob 2023-07-09 18:35:46 +02:00
parent a28b56f481
commit ee31cf06d4

View file

@ -34,17 +34,23 @@ namespace EnvyUpdate
private void chkLog_Checked(object sender, RoutedEventArgs e) private void chkLog_Checked(object sender, RoutedEventArgs e)
{ {
Debug.isVerbose = true; if (!Debug.isVerbose)
Debug.LogToFile("------"); {
Debug.LogToFile("INFO Enabled logging to file. Restart Application to see full startup log."); 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) private void chkLog_Unchecked(object sender, RoutedEventArgs e)
{ {
Debug.LogToFile("INFO Disabled logging to file."); if (Debug.isVerbose)
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.LogToFile("INFO Disabled logging to file.");
Debug.isVerbose = false; 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;
}
} }
} }
} }