Remove build files

This commit is contained in:
P-A
2026-03-29 21:28:36 +02:00
parent fee887de03
commit bf4adb72eb
272 changed files with 42 additions and 8266 deletions

View File

@@ -1,3 +1,5 @@
using Microsoft.Extensions.Configuration;
namespace Logger;
/// <summary>
@@ -18,6 +20,41 @@ public static class LoggerFactory
return new CompositeLogger(consoleLogger, fileLogger);
}
/// <summary>
/// Create a logger from configuration section
/// </summary>
public static ILogger CreateFromConfiguration(IConfiguration configuration)
{
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
var section = configuration.GetSection("Logger");
var consoleLevelString = section.GetValue("ConsoleMinimumLevel", "Trace");
var consoleLevel = ParseLogLevel(consoleLevelString);
var fileOptions = section.GetSection("File").Get<FileLoggerOptions>() ?? new FileLoggerOptions();
return CreateCompositeLogger(consoleLevel, fileOptions);
}
private static LogLevel ParseLogLevel(string? level)
{
if (string.IsNullOrWhiteSpace(level))
return LogLevel.Trace;
return level.Trim().ToLowerInvariant() switch
{
"trace" => LogLevel.Trace,
"debug" => LogLevel.Debug,
"info" => LogLevel.Info,
"information" => LogLevel.Info,
"warn" => LogLevel.Warning,
"warning" => LogLevel.Warning,
"error" => LogLevel.Error,
"fatal" => LogLevel.Fatal,
_ => LogLevel.Trace
};
}
/// <summary>
/// Create a console-only logger
/// </summary>