This commit is contained in:
2026-01-31 14:59:45 +01:00
parent cb3bfaaa91
commit fe091cd296
3 changed files with 4 additions and 4 deletions

View File

@@ -91,7 +91,7 @@ public class HeaderTokens
["sev"] = ctx => $"[Severity: {ctx.LogType}]",
["LogType"] = ctx => $"[{ctx.LogType}]",
["logtype"] = ctx => $"[{ctx.LogType}]",
["user"] = _ => $"[User: {Environment.UserName}]",

View File

@@ -24,7 +24,7 @@ public class LoggerSettings
private FileLoggerOptions _fileLoggerOptions;
private string _headerFormat = "{ts} {tz} {host} {category} {thread} {LogType}";
private string _headerFormat = "{ts} {tz} {host} {category} {thread} {logtype}";
private string _timestampFormat = "yyyy-MM-dd HH:mm:ss";
/// <summary>

View File

@@ -76,7 +76,7 @@
logger.LoggerSettings.CustomHeaderFormatter = null; // remove the lambda
logger.LoggerSettings.HeaderTokens.AddCustomToken("AppName", x => "[JIJ BENT EEN BRASSER!]");
logger.LoggerSettings.HeaderFormat = "{AppName} {LogType} {ts}";
logger.LoggerSettings.HeaderFormat = "{AppName} {logtype} {ts}";
// Configure the client
var centralOptions = new LogCentralOptions
@@ -98,7 +98,7 @@
// Now all EonaCat.Logger logs will be sent to LogCentral automatically
await logger.LogAsync("This is a test log message sent to LogCentral!", ELogType.INFO).ConfigureAwait(false);
var jsonLogger = new JsonFileLoggerProvider().CreateLogger("MyCategory") as JsonFileLogger;
var jsonLogger = new JsonFileLogger("Category", new JsonFileLoggerOptions { FileName = "test.json" });
jsonLogger?.SetContext("CorrelationId", "abc-123");
jsonLogger?.SetContext("UserId", "john.doe");
jsonLogger?.LogInformation("User logged in");