Updated
This commit is contained in:
@@ -91,7 +91,7 @@ public class HeaderTokens
|
|||||||
|
|
||||||
["sev"] = ctx => $"[Severity: {ctx.LogType}]",
|
["sev"] = ctx => $"[Severity: {ctx.LogType}]",
|
||||||
|
|
||||||
["LogType"] = ctx => $"[{ctx.LogType}]",
|
["logtype"] = ctx => $"[{ctx.LogType}]",
|
||||||
|
|
||||||
["user"] = _ => $"[User: {Environment.UserName}]",
|
["user"] = _ => $"[User: {Environment.UserName}]",
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class LoggerSettings
|
|||||||
|
|
||||||
private FileLoggerOptions _fileLoggerOptions;
|
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";
|
private string _timestampFormat = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
logger.LoggerSettings.CustomHeaderFormatter = null; // remove the lambda
|
logger.LoggerSettings.CustomHeaderFormatter = null; // remove the lambda
|
||||||
logger.LoggerSettings.HeaderTokens.AddCustomToken("AppName", x => "[JIJ BENT EEN BRASSER!]");
|
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
|
// Configure the client
|
||||||
var centralOptions = new LogCentralOptions
|
var centralOptions = new LogCentralOptions
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
// Now all EonaCat.Logger logs will be sent to LogCentral automatically
|
// 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);
|
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("CorrelationId", "abc-123");
|
||||||
jsonLogger?.SetContext("UserId", "john.doe");
|
jsonLogger?.SetContext("UserId", "john.doe");
|
||||||
jsonLogger?.LogInformation("User logged in");
|
jsonLogger?.LogInformation("User logged in");
|
||||||
|
|||||||
Reference in New Issue
Block a user