We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is your feature request related to a problem? Please describe.
With Zap's sugared logger, if you provide a plain error object to Infow/Errorw/etc., it does not desugar the error into a zap.Field.
log.Warnw("something happened", err) // bad log.Warnw("something happened", "err", err) // good // desugars to log.Desugar().Warn("something happened", zap.NamedError("err", err))
This is inconvenient for the majority case where there will be only one error.
Describe the solution you'd like
We should turn the first case into,
log.Desugar().Warn("something happened", zap.Error(err))
We could even be smart about it in desugarFields and make sure there's only one instance of "err". Others have to have a field name.
Describe alternatives you've considered
Add "err" next to every err argument.
Is this a breaking change? No
The text was updated successfully, but these errors were encountered:
I would like to try giving this a shot if that's okay?
Sorry, something went wrong.
Sure, @craigpastro!
Successfully merging a pull request may close this issue.
Is your feature request related to a problem? Please describe.
With Zap's sugared logger, if you provide a plain error object to Infow/Errorw/etc.,
it does not desugar the error into a zap.Field.
This is inconvenient for the majority case where there will be only one error.
Describe the solution you'd like
We should turn the first case into,
We could even be smart about it in desugarFields
and make sure there's only one instance of "err".
Others have to have a field name.
Describe alternatives you've considered
Add "err" next to every err argument.
Is this a breaking change?
No
The text was updated successfully, but these errors were encountered: