fix log color

This commit is contained in:
2024-07-24 21:50:46 +08:00
parent 45e19c3561
commit 56b0490d1e
+3 -2
View File
@@ -13,7 +13,7 @@ public class SimApiLogger(string name) : ILogger
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception,
Func<TState, Exception, string> formatter) Func<TState, Exception, string> formatter)
{ {
var color = logLevel switch Console.ForegroundColor = logLevel switch
{ {
LogLevel.Debug => ConsoleColor.DarkMagenta, LogLevel.Debug => ConsoleColor.DarkMagenta,
LogLevel.Information => ConsoleColor.DarkCyan, LogLevel.Information => ConsoleColor.DarkCyan,
@@ -29,6 +29,7 @@ public class SimApiLogger(string name) : ILogger
message += $"{exception}\n"; message += $"{exception}\n";
} }
Console.WriteLine(message, color); Console.WriteLine(message);
Console.ResetColor();
} }
} }