Closed bbrandt closed 8 years ago
I'm not aware of anything, but @nblumhardt will answer more definitively if he gets a chance.
To parse and manipulate the message templates, see https://messagetemplates.org/
Another option is to use the pre-rendered version.
There isn't a packaged one I'm aware of, but this block of code from one of the Seq Apps does the part of taking a (JSON.NET-deserialized) bag of plain object properties plus a template to reconstruct a renderable LogEvent
.
It'd be cool to create a more minimal implementation based on one of the messagetemplates projects :-)
If we built it, where would the project live? Would it belong here in serilog-formatting-compact, with messagetemplates-csharp, or elsewhere?
That's a good question; I don't think it'd live in Serilog.Formatting.Compact because of the JSON parser dependency; the messagetemplates libraries are really just supporting the message template spec, so I don't think it'd belong there.
It seems like there are two possible goals:
LogEvent
s, effectively using the compact format as a serialization/wire format, orIf it's the first, taking a dependency on Serilog and building it as essentially a "Serilog component" seems like the way to go. In that case, spiking it in a private repo and moving forwards from there (possibly to include it in the /serilog org when done) would be the next step.
If it's the second, taking a dependency on messagetemplates-csharp and making it a completely independent top-level project would make sense.
Depends a lot on the use case, but either would no doubt be worthwhile.
Yes. I can see the value in both of those goals. For now my immediate need is closer to the 2nd, so I may move in that direction first, if time permits. Thanks for the input!
Is there currently an implementation that will parse the output of CompactJsonFormatter with the message template and properties and render a message?