Open rcdailey opened 1 year ago
I'm trying to replace the normal template with an ExpressionTemplate
in my local fork, but this does not seems to be easy.
MessageTemplateParser
is made for regular template and is unable to recognize regular tokens from expressions. The extracted tokens are not exposed (see here).
The easy way I can think of is to manually exclude the expression tokens inside the sink constructor, but this means it only works with a predefined expression template (meaning that every change done to the template will also need changes to the source code).
Serilog provides the Sink
method which allows to wrap and override the Emit
method, but at this point of the process there is less space for customization and I have no idea on what can be done here.
Have you managed to solve the issue?
No, I am simply not using this library until it is properly supported. I am not really interested in trying to hack a solution, even if it may be possible.
There is also a C# port of the library, but with the same issue. I'm afraid that this is not going to be supported mostly because Spectre console rendering requires an IRenderable
collection and the proper way to support expressions (hope to be wrong) would be a complete rewrite.
What alternative are you using now? I remember that some years ago I searched for something else when I become aware about this issue, but I found nothing that can even compare with Serilog.
I'm not able to pass in an
ExpressionTemplate
from theSerilog.Expressions
package. That makes this library unfortunately unusable for my use case.Like other sinks, this is a matter of supporting
ITextFormatter
.