Open mpiliszcz opened 1 year ago
Indeed you can't have both, but that's how the Serilog.Sinks.Console package works. This is not related to this Serilog.Settings.Configuration
package.
If you write it programmatically you can configure either the theme:
configuration.WriteTo.Console(theme: AnsiConsoleTheme.Code);
or the formatter:
configuration.WriteTo.Console(formatter: new ExpressionTemplate("[{@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}"));
But you can't have both, this does not even compile:
configuration.WriteTo.Console(
theme: AnsiConsoleTheme.Literate,
formatter: new ExpressionTemplate("[{@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}")
);
Does this answer address your issue?
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.