serilog / serilog-formatting-compact

Compact JSON event format for Serilog
Apache License 2.0
153 stars 45 forks source link

Does a render exist for the CompactJsonFormatter? #8

Closed bbrandt closed 8 years ago

bbrandt commented 8 years ago

Is there currently an implementation that will parse the output of CompactJsonFormatter with the message template and properties and render a message?

adamchester commented 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.

nblumhardt commented 8 years ago

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 :-)

bbrandt commented 8 years ago

If we built it, where would the project live? Would it belong here in serilog-formatting-compact, with messagetemplates-csharp, or elsewhere?

nblumhardt commented 8 years ago

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:

If 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.

bbrandt commented 8 years ago

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!