MessageTemplate
martinstrimpfl opened this issue · 8 comments
How to force this sink to output the MessageTemplate property too?
@martinstrimpfl Sink is emitting rendered message instead of MessageTemplate. I believe a good message is better than cryptic template but if there is a better use case, it can be made part of log message in later releases.
The reasons for the MessageTeplate field introduction are described here: https://nblumhardt.com/2014/09/how-not-to-parameterize-serilog-events/
IMHO it would be left to the user to decide whether to render the Message or to write the MessageTemplate or to use both.
Another option is to include a hash value of the template in the Properties.
Under the hood, same good practiced is being followed except message rendering part. In practice I got mixed signals from end users asking where is message?
Initially, I was showing message template but people were asking what is this message? MessageTemplate": "The time is {Time},
. Mostly there were expecting a complete message instead of template.
However, I'm still storing message properties as object for application or automated processing. Inclusion of Message Template as hash is an option too.
@nblumhardt your input please.
IMHO the inclusion of the MT's hash would be a nice solution - it would keep the message readable when allowing the search for all the occurrences at the same time.
Is it possible to implement it? I've done it locally but I am not allowed to push my changes (in a branch) to the repo.
Indeed its possible but will take some time before it make its way nuget.
MessageTemplate and EventIdHash exposed. Please see #38