is it fine to use pointer receiver struct for the hook ?
hanks opened this issue · comments
For the example:
type SeverityHook struct{}
func (h SeverityHook) Run(e *zerolog.Event, level zerolog.Level, msg string) {
if level != zerolog.NoLevel {
e.Str("severity", level.String())
}
}
hooked := log.Hook(SeverityHook{})
hooked.Warn().Msg("")
// Output: {"level":"warn","severity":"warn"}
is it possible to use the pointer receiver like below, is there any limitations? thanks
type SeverityHook struct{}
func (h *SeverityHook) Run(e *zerolog.Event, level zerolog.Level, msg string) {
if level != zerolog.NoLevel {
e.Str("severity", level.String())
}
}
hooked := log.Hook(&SeverityHook{})
hooked.Warn().Msg("")