Some updated logging colours

This commit is contained in:
Toastie 2024-12-26 19:26:54 +13:00
parent 9ef4364a13
commit 233fd3278b
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -93,7 +93,12 @@ public class Logger : ILogger
Console.ResetColor();
Console.ForegroundColor = GetLogLevelColour(logLevel);
if (logLevel == LogLevel.Critical)
{
Console.BackgroundColor = ConsoleColor.DarkRed;
}
Console.Write($"{DateTimeOffset.UtcNow.ToString("yyyy-MM-dd HH:mm:ss")}");
Console.ResetColor();
Console.ForegroundColor = ConsoleColor.Gray;
Console.Write("] ");
@ -124,10 +129,15 @@ public class Logger : ILogger
{
Console.ForegroundColor = ConsoleColor.Gray;
}
else if (logLevel is LogLevel.Critical or LogLevel.Error)
{
Console.ForegroundColor = ConsoleColor.Red;
}
Console.WriteLine(formatter(state, exception));
if (exception != null)
{
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine($"{exception} : {exception.Message}\n{exception.StackTrace}");
}