Some updated logging colours
This commit is contained in:
parent
9ef4364a13
commit
233fd3278b
1 changed files with 10 additions and 0 deletions
10
Logger.cs
10
Logger.cs
|
@ -93,7 +93,12 @@ public class Logger : ILogger
|
||||||
|
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
Console.ForegroundColor = GetLogLevelColour(logLevel);
|
Console.ForegroundColor = GetLogLevelColour(logLevel);
|
||||||
|
if (logLevel == LogLevel.Critical)
|
||||||
|
{
|
||||||
|
Console.BackgroundColor = ConsoleColor.DarkRed;
|
||||||
|
}
|
||||||
Console.Write($"{DateTimeOffset.UtcNow.ToString("yyyy-MM-dd HH:mm:ss")}");
|
Console.Write($"{DateTimeOffset.UtcNow.ToString("yyyy-MM-dd HH:mm:ss")}");
|
||||||
|
Console.ResetColor();
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
Console.Write("] ");
|
Console.Write("] ");
|
||||||
|
@ -124,10 +129,15 @@ public class Logger : ILogger
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
}
|
}
|
||||||
|
else if (logLevel is LogLevel.Critical or LogLevel.Error)
|
||||||
|
{
|
||||||
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
|
}
|
||||||
Console.WriteLine(formatter(state, exception));
|
Console.WriteLine(formatter(state, exception));
|
||||||
|
|
||||||
if (exception != null)
|
if (exception != null)
|
||||||
{
|
{
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
Console.WriteLine($"{exception} : {exception.Message}\n{exception.StackTrace}");
|
Console.WriteLine($"{exception} : {exception.Message}\n{exception.StackTrace}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue