I am trying to create a global output template for Serilog messages, in the following format:
{Timestamp:yyyy-MM-dd HH:mm:ss,fff} [{ComponentName}, {ApplicationName}, {ThreadId}] {Level} ({ErrorId}): {Message} {Exception}
The problem I am facing is that some messages do not contain error or exception identifiers or ThreadIds. So, when this happens, I get a message with a lot of characters that add noise to the log message, for example,
2015-06-24 15:11:03,234 [Component, MyApp, ] Info (): This is a message that I'm writing
Is it possible that Serilog supports optional parameters in the message template?
source
share