fix log color

This commit is contained in:
2024-07-24 21:43:31 +08:00
parent 04b2be1bb7
commit 45e19c3561
+2 -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)
{ {
Console.ForegroundColor = logLevel switch var color = logLevel switch
{ {
LogLevel.Debug => ConsoleColor.DarkMagenta, LogLevel.Debug => ConsoleColor.DarkMagenta,
LogLevel.Information => ConsoleColor.DarkCyan, LogLevel.Information => ConsoleColor.DarkCyan,
@@ -29,6 +29,6 @@ public class SimApiLogger(string name) : ILogger
message += $"{exception}\n"; message += $"{exception}\n";
} }
Console.WriteLine(message); Console.WriteLine(message, color);
} }
} }