Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: use Labels command more than once #16

Open
kitagry opened this issue May 14, 2021 · 1 comment
Open

Proposal: use Labels command more than once #16

kitagry opened this issue May 14, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@kitagry
Copy link
Contributor

kitagry commented May 14, 2021

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")
@hirosassa
Copy link
Owner

hirosassa commented May 14, 2021

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?

@hirosassa hirosassa added the enhancement New feature or request label May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants