Open WUST-mengqinyu opened 7 months ago
I would like something like this too! I have a hook that adds trace data to the logs. In that (or another) hook I would also like to add bits and pieces of the log event to the trace in cases of high severity. However now it's not possible to lift any information out of the zerolog event. a .Read()
method on the event would be very nice.
edit: On further reading there seems to be a workable solution here https://github.com/rs/zerolog/issues/493 @WUST-mengqinyu would be nicer with something that doesn't involve reflecting though.
The buf is an internal structure containing the incomplete event in the making. It is not meant to be exposed.
Or alternatively, is it possible to get the 'Context' in the Writer?