cocowalla / serilog-sinks-file-header

Plugin for the Serilog File sink that writes a header at the start of each log file
Apache License 2.0
10 stars 3 forks source link

Suggestion: Show example output in the readme file #4

Closed LiorBanai closed 4 years ago

LiorBanai commented 4 years ago

Hi, I may add parsing of the header in my Serilog parser for my Analogy log viewer. I suggest to update the readme with example of input and output (or even in unit test) so it will be easier to integrate your work in other projects. Could be related to out repositories like the compressed file repos. I plan to add support for compressed file in my viewer :)

cocowalla commented 4 years ago

I'm not sure it would make sense to add an example to the readme, as this projects doesn't add a standard header - it's completely up to the caller to tell it what header to write (can be a string, or a Func). Your header can be an ASCII Rick Roll if you really want :laughing:

Serilog message templates are also completely customisable; while there is a default, there is no one size fits all so its very common to change it. Furthermore, Serilog message templates typically only use a space character to delimit fields (although this is of course customisable :smile:).

But now you've given me the idea, it would be interesting to see if it's possible to automatically write a standardised header based on the message template. Getting access to the template is likely to be problematic tho, as Serilog doesn't expose sinks and configs at runtime... might be possible to get this during building of the ILogger, though it's likely to be ugly :smile:

Your log parser looks interesting BTW. I generally just use a text editor and some regex-foo to filter to what I want, but an actual UI and a ability to save patterns could be pretty useful!

LiorBanai commented 4 years ago

I see. So there is no point in adding example indeed to the readme 🙂.

Thanks for explaining in detail 👍