Added custom token support

This commit is contained in:
2026-01-30 21:23:39 +01:00
parent f54d40b092
commit 9c77e61ec9
6 changed files with 172 additions and 28 deletions

View File

@@ -24,7 +24,7 @@ public class LoggerSettings
private FileLoggerOptions _fileLoggerOptions;
private string _headerFormat = "{ts} {host} {category} {thread} {sev}";
private string _headerFormat = "{ts} {tz} {host} {category} {thread} {sev}";
private string _timestampFormat = "yyyy-MM-dd HH:mm:ss";
/// <summary>
@@ -32,8 +32,18 @@ public class LoggerSettings
/// </summary>
public bool UseLocalTime { get; set; }
/// <summary>
/// Gets or sets the unique identifier for the application instance.
/// </summary>
public string Id { get; set; } = DllInfo.ApplicationName;
/// <summary>
/// Gets or sets the collection of custom header tokens to be included in outgoing requests.
/// </summary>
/// <remarks>Use this property to specify additional headers that should be sent with each request.
/// Modifying the collection affects all subsequent requests made by this instance.</remarks>
public HeaderTokens HeaderTokens { get; set; } = new HeaderTokens();
/// <summary>
/// Header format. Provide a string that specifies how the preamble of each message should be structured. You can use
/// variables including:
@@ -42,7 +52,7 @@ public class LoggerSettings
/// {category}: Category
/// {thread}: Thread ID
/// {sev}: Severity
/// Default: {ts} {host} {category} {thread} {sev}
/// Default: {ts} {tz} {host} {category} {thread} {sev}
/// A space will be inserted between the header and the message.
/// </summary>
public string HeaderFormat