This commit is contained in:
2022-12-16 12:59:34 +01:00
parent 5d3c85ffd3
commit 795f9807d5
8 changed files with 96 additions and 48 deletions

View File

@@ -1,8 +1,7 @@
using System.IO;
using System;
using System;
using System.Collections.Generic;
using EonaCat.Logger.Syslog;
using System.Runtime;
using EonaCatLogger.EonaCatCoreLogger.Models;
namespace EonaCat.Logger.Managers
{
@@ -11,6 +10,10 @@ namespace EonaCat.Logger.Managers
/// </summary>
public class LoggerSettings
{
public event LogDelegate OnLog;
public delegate void LogDelegate(EonaCatLogMessage message);
/// <summary>
/// Header format. Provide a string that specifies how the preamble of each message should be structured. You can use variables including:
/// {ts}: UTC timestamp
@@ -67,11 +70,6 @@ namespace EonaCat.Logger.Managers
}
}
/// <summary>
/// Minimum severity required to send a message.
/// </summary>
public ESeverity MinimumSeverity { get; set; } = ESeverity.Debug;
/// <summary>
/// Enable or disable use of color for console messages.
/// </summary>
@@ -148,6 +146,11 @@ namespace EonaCat.Logger.Managers
}
}
/// <summary>
/// Set the origin of where the OnLog event was inititated
/// </summary>
public string LogOrigin { get; set; }
private string _HeaderFormat = "{ts} {host} {thread} {sev}";
private string _TimestampFormat = "yyyy-MM-dd HH:mm:ss";
private bool _EnableConsole = true;
@@ -169,5 +172,14 @@ namespace EonaCat.Logger.Managers
}
}
internal void OnLogEvent(EonaCatLogMessage eonaCatLogMessage)
{
OnLog?.Invoke(eonaCatLogMessage);
}
internal void ResetLogEvent()
{
OnLog = null;
}
}
}