Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehjohn committed Aug 13, 2024
1 parent 362ab08 commit c72d810
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
3 changes: 0 additions & 3 deletions src/Zen.Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
22 changes: 15 additions & 7 deletions src/Zen.Common/Infrastructure/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
});
}
}

0 comments on commit c72d810

Please sign in to comment.