This commit is contained in:
2023-07-13 12:01:34 +02:00
parent bfb2b8a999
commit 6f158901a2
3 changed files with 38 additions and 13 deletions

View File

@@ -6,17 +6,9 @@ namespace EonaCat.Logger.Test.Web
{
public static class Logger
{
private static readonly LogManager LogManager = new LogManager(new LoggerSettings
{
Id = "EonaCatDnsLogger",
MaxLogType = ELogType.TRACE,
FileLoggerOptions =
{
LogDirectory = "Logs",
FileSizeLimit = 20_000_000, // 20 MB
}
});
public static ELogType MaxLogType { get; set; }
public static bool UseLocalTime { get; set; }
private static LogManager LogManager;
public static string LogFolder => "Logs";
public static string CurrentLogFile => LogManager.CurrentLogFile;
public static bool IsDisabled { get; set; }
@@ -108,5 +100,22 @@ namespace EonaCat.Logger.Test.Web
LogManager.Write(exception, module: message, writeToConsole: writeToConsole);
}
public static void Configure()
{
var loggerSettings = new LoggerSettings
{
Id = "EonaCatDnsLogger",
MaxLogType = ELogType.TRACE,
UseLocalTime = UseLocalTime,
FileLoggerOptions =
{
LogDirectory = "Logs",
FileSizeLimit = 20_000_000, // 20 MB,
UseLocalTime = UseLocalTime,
}
};
LogManager = new LogManager(loggerSettings);
}
}
}