Closed SoggyBottomBoy closed 5 months ago
I think this is by design since memory sink just buffers log events. There is nothing to format because there is no output message.
That’s correct.
The sink isn’t meant to verify log message formatting, it’s meant to verify that a message is logged in a certain way. For example that the message template is correct and that the right properties are set on it.
Ok but the RenderMessage therefore can not be configured, and the extension method includes this option but in the code is simply not used which is misleading.
Am I right in thinking the InMemorySink does not provide an option to set the outputFormatter? Because of the async nature of the InMemorySink.Instance I have had to register an instance of a singleton in my DI container. I want to include the Exception message in the RenderMessage but can't figure out how to do this.
This is the code I have
A ConsoleSink for example takes a formatter as part of its constructor, however the same does not existing for the InMemorySink.
Is there any way to set the message formatter. It also appears that the extension method does nothing with the formatter? https://github.com/serilog-contrib/SerilogSinksInMemory/blob/master/src/Serilog.Sinks.InMemory/InMemorySinkExtensions.cs