Closed ikedam closed 1 year ago
+1 for this feature. I was just about to ask about adding prehooks and found this PR. Prehooks like this will be useful for making logs more easily human readable.
@rs is there any interest in adding this feature? (Thanks for your work on zerlolog btw, it's great!)
Hi @rs, sorry to bother you again. I just wanted to check in to see if this is something you would consider adding? If there's anything I could do to help get this merged, please let me know.
Thanks again for all your work on zerolog.
I'm not comfortable adding such complexity just for field ordering. I would recommend using tools to read JSON logs instead of dealing with raw output.
Thanks for comments. Close with won't merge.
Multiple log files can be sorted with
sort
if "time" key comes first. For example:It would be useful in environments where logs aren't managed with log managing systems like Google Cloud Logging, AWS CloudWatch, and so on.
What I did:
Prehook()
feature. It calls hooks just before "level" is added to the buffer.Pretimestamp()
feature. It adds timestamp hook withPrehook
.