-
Notifications
You must be signed in to change notification settings - Fork 831
Description
From: serilog/serilog-extensions-logging-file#7
When Serilog renders data, it uses a JSON-like representation, so strings end up "like this"
while numbers are 123
and arrays [1, 2, 3]
etc.
(Personal note - I can see the downside for some, but I still love this feature as it makes clear that there's more type information behind the scenes, when you can't use a sink with structured data support.)
In some cases, especially when trying to match legacy file output, it'd be nice to switch this off and just pretend we're a fancy string.Format()
. Opting out at the level of individual tokens ({0:l}
) doesn't really achieve what's desired here. It'd be nicer to override the rendering at a higher level.
One option for achieving this would be to modify MessageTemplateTextFormatter
's handling of {Message}
so that the :l
is applied to the tokens within the message; e.g.:
"{Timestamp:o} {RequestId,13} [{Level:u3}] {Message:l} ({EventId:x8}){NewLine}{Exception}"
Implementation strategy needs some investigation, but doesn't seem like it will be too complicated.