serilog-settings-configuration
serilog-settings-configuration copied to clipboard
Configuring Console with theme overrides ExpressionTemplate
"Serilog": {
"Using": [ "Serilog.Sinks.Console" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"System": "Information"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"formatter": {
"type": "Serilog.Templates.ExpressionTemplate, Serilog.Expressions",
"template": "[{@t:HH:mm:ss}{#if CorrelationId is not null} {Substring(CorrelationId, 0,5)}{#end} {@l:u3}] {#if SourceContext is not null}{SourceContext}{#end}{@m}\n{@x}"
}//,
//"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Literate, Serilog.Sinks.Console"
}
}
],
"Enrich": [ "WithCorrelationId" ]
},
If I remove commented out theme definition, the formatter will no longer be used, only theme will be finally configured. We can't have both.