zerodriver
zerodriver copied to clipboard
Proposal: use Labels command more than once
Currently, Labels returns *zerolog.Event. So, we can't call Labels command more than once.
I want to do it as follows.
Do you think about this?
// prepare common label
commonLogger := logger.Info().Labels(zerodriver.Label("label", "common"))
commonLogger.Labels("phase", "1").Msg("hoge")
commonLogger.Labels("phase", "2").Msg("fuga")
Thanks for your suggestion!
I agree with your idea, too, but there is a problem of go's receiver specification (you cannot add methods on a receiver defined in different package).
Also, if Lables returns zerodriver.Event, then you cannot call Msg or other zerolog's methods.
Do you have any idea to solve this problem?