c# - Define multiple sinks with different outputTemplates based on logging level in xml config for Serilog -
is there way define multiple sinks in xml config serilog allow outputtemplate change based on level of log?
i have:
<add key="serilog:minimum-level" value="verbose" /> <add key="serilog:write-to:coloredconsole" /> <add key="serilog:write-to:rollingfile.pathformat" value="c:\logs\adapterservice-{date}.txt" /> <add key="serilog:write-to:rollingfile.retainedfilecountlimit" value="10" /> <add key="serilog:write-to:rollingfile.outputtemplate" value="[{timestamp:g}] [{level}] [{sourcecontext:l}] {message}{newline:l}{exception:l}" />
however debug level logs not include sourcecontext string in:
<add key="serilog:write-to:rollingfile.outputtemplate" value="[{timestamp:g}] [{level}] {message}{newline:l}{exception:l}" />
i aware can set restrictedtominimumlevel: logeventlevel.verbose
unsure how in xml.
Comments
Post a Comment