mirror of
https://github.com/tribufu/tribufu-dotnet
synced 2025-06-15 18:04:18 +00:00
Update log levels
This commit is contained in:
@ -11,7 +11,7 @@ namespace Tribufu.Test
|
|||||||
{
|
{
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
Logger.Initialize(LogLevel.All);
|
Logger.Initialize(LogLevel.Trace);
|
||||||
|
|
||||||
DotEnv.Load(new DotEnvOptions(ignoreExceptions: true, envFilePaths: [".env", "../../.env"]));
|
DotEnv.Load(new DotEnvOptions(ignoreExceptions: true, envFilePaths: [".env", "../../.env"]));
|
||||||
|
|
||||||
|
@ -7,16 +7,14 @@ namespace Tribufu.Logging
|
|||||||
{
|
{
|
||||||
Off = 0,
|
Off = 0,
|
||||||
|
|
||||||
Trace = 1,
|
Error = 1,
|
||||||
|
|
||||||
Debug = 2,
|
Warn = 2,
|
||||||
|
|
||||||
Info = 3,
|
Info = 3,
|
||||||
|
|
||||||
Warn = 4,
|
Debug = 4,
|
||||||
|
|
||||||
Error = 5,
|
Trace = 5,
|
||||||
|
|
||||||
All = 6,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,7 @@ namespace Tribufu.Logging
|
|||||||
|
|
||||||
private static void Log(LogLevel level, string message, ConsoleColor color)
|
private static void Log(LogLevel level, string message, ConsoleColor color)
|
||||||
{
|
{
|
||||||
if (_level == LogLevel.Off)
|
if (level <= _level)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_level == LogLevel.All || level >= _level)
|
|
||||||
{
|
{
|
||||||
var defaultColor = Console.ForegroundColor;
|
var defaultColor = Console.ForegroundColor;
|
||||||
Console.ForegroundColor = color;
|
Console.ForegroundColor = color;
|
||||||
|
Reference in New Issue
Block a user