diff --git a/src/Zen.Common/Constants.cs b/src/Zen.Common/Constants.cs index 906fc244..911cc803 100644 --- a/src/Zen.Common/Constants.cs +++ b/src/Zen.Common/Constants.cs @@ -57,7 +57,4 @@ public static class Constants public const int VideoRamVisualisationPanelWidth = ScreenWidthPixels; public const int SlowScanFactor = 4; - - /* Miscellaneous */ - public const string ExceptionsLogFileName = "exceptions.log"; } \ No newline at end of file diff --git a/src/Zen.Common/Infrastructure/Logger.cs b/src/Zen.Common/Infrastructure/Logger.cs index 2b057d43..e8d6d2b0 100644 --- a/src/Zen.Common/Infrastructure/Logger.cs +++ b/src/Zen.Common/Infrastructure/Logger.cs @@ -2,14 +2,22 @@ public static class Logger { + private static readonly string LogFile; + + static Logger() + { + LogFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "zen.log"); + } + public static void LogException(string className, Exception exception) { - File.AppendAllLines(Constants.ExceptionsLogFileName, new[] - { - "--------------------------------------------------------------------------------", - $"Time: {DateTime.UtcNow:u}", - $"Component: {className}", - exception.ToString() - }); + + File.AppendAllLines(LogFile, new[] + { + "--------------------------------------------------------------------------------", + $"Time: {DateTime.UtcNow:u}", + $"Component: {className}", + exception.ToString() + }); } } \ No newline at end of file