serilog-contrib / serilog-sinks-slack

A simple (yet customizable) Slack logging sink for Serilog
MIT License
41 stars 27 forks source link

Add support for outputTemplate message formatting #16

Closed zaha closed 3 years ago

zaha commented 7 years ago

Hi,

we recently introduced Slack in our company and I would love to output Error/Fatal log messages into a channel. I managed to do so with this sink in minutes. 👍

While fiddling around with it I tried to set an outputeTemplate parameter to control the rendered text messages in the logs, but couldn't find any such parameter. Does this sink not support this? I want to have several web services log into a single channel and without contextual information like the SourceContext or a RequestID in the log message it would be impossible to tell from which web service a log came or what's related.

Could you add this parameter to support the typical way of formatting the log messages in Serilog?

Kind regards Michael

mgibas commented 7 years ago

I don't think its supported at the moment. I don't have resources (time, env) to make this change, but you are welcome to create PR - I should be able to merge that in reasonable time :)

TrapperHell commented 3 years ago

There is currently no support for an outputTemplate as you may be accustomed to, however you can make use of custom properties (either with enrichers during startup registration) or dynamic properties at runtime ( logger.LogInformation("{RequestCount} requests have been served", requests.Count); ). Considering the age of the original comment, I am closing this issue.