This commit is contained in:
Jeroen Saey
2025-02-18 08:38:52 +01:00
parent a5c00a07e1
commit 3cec432b39
5 changed files with 67 additions and 29 deletions

View File

@@ -8,7 +8,6 @@ namespace EonaCat.Logger.Test.Web;
public class Logger
{
private LogManager _logManager;
public List<ELogType> TypesToLog { get; set; } = new List<ELogType>();
public LoggerSettings LoggerSettings { get; }
public bool UseLocalTime { get; set; }
public string LogFolder { get; set; } = Path.Combine(FileLoggerOptions.DefaultPath, "logs");
@@ -25,12 +24,11 @@ public class Logger
public Logger(string name = "EonaCatTestLogger", List<ELogType> typesToLog = null, bool useLocalTime = false, int maxFileSize = 20_000_000)
{
UseLocalTime = useLocalTime;
TypesToLog = typesToLog;
LoggerSettings = new LoggerSettings
{
Id = name,
TypesToLog = TypesToLog,
TypesToLog = typesToLog,
UseLocalTime = UseLocalTime,
FileLoggerOptions =
{
@@ -136,7 +134,7 @@ public class Logger
return;
}
if (TypesToLog.Contains(ELogType.ERROR))
if (LoggerSettings.TypesToLog.Contains(ELogType.ERROR))
{
await _logManager.WriteAsync(exception, message, writeToConsole: writeToConsole).ConfigureAwait(false);
}