-
Notifications
You must be signed in to change notification settings - Fork 707
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
ctxloggers for zap and logrus should live with logging #128
ctxloggers for zap and logrus should live with logging #128
Conversation
Codecov Report
@@ Coverage Diff @@
## master #128 +/- ##
==========================================
+ Coverage 73.2% 73.68% +0.47%
==========================================
Files 36 36
Lines 1284 1292 +8
==========================================
+ Hits 940 952 +12
+ Misses 295 293 -2
+ Partials 49 47 -2
Continue to review full report at Codecov.
|
tags/zap/context.go
Outdated
} | ||
|
||
// TagsToFields transforms the Tags on the supplied context into zap fields. | ||
func TagsToFields(ctx context.Context) []zapcore.Field { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should maintain the public API here
tags/zap/context.go
Outdated
|
||
// ToContext adds the zap.Logger to the context for extraction later. | ||
// Returning the new context that has been created. | ||
func ToContext(ctx context.Context, logger *zap.Logger) context.Context { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM minus some nits
tags/zap/context.go
Outdated
} | ||
|
||
// ToContext adds the zap.Logger to the context for extraction later. | ||
// Returning the new context that has been created. | ||
// Deprecated: use ctxzap.ToContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should keep the original docs line
I think it would fit much better if the ctxloggers for both zap and logrus lived under the logging sub folder rather than with the tags ... although they add tags to logger on the context the primary use is for them to be used to add fields to the context.