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

ctxloggers for zap and logrus should live with logging #128

Merged
merged 3 commits into from
Feb 28, 2018
Merged

ctxloggers for zap and logrus should live with logging #128

merged 3 commits into from
Feb 28, 2018

Conversation

domgreen
Copy link
Contributor

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.

@codecov-io
Copy link

codecov-io commented Feb 23, 2018

Codecov Report

Merging #128 into master will increase coverage by 0.47%.
The diff coverage is 11.32%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
tracing/opentracing/server_interceptors.go 79.06% <ø> (ø) ⬆️
logging/zap/ctxzap/context.go 0% <0%> (ø)
logging/zap/context.go 0% <0%> (ø) ⬆️
logging/logrus/ctxlogrus/context.go 0% <0%> (ø)
logging/zap/server_interceptors.go 100% <100%> (ø) ⬆️
logging/logrus/server_interceptors.go 92.1% <100%> (ø) ⬆️
logging/zap/payload_interceptors.go 84.61% <100%> (ø) ⬆️
logging/logrus/context.go 50% <50%> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0c54e6...62a6cf8. Read the comment docs.

@domgreen domgreen requested a review from yifanzz February 27, 2018 15:16
@domgreen domgreen self-assigned this Feb 27, 2018
}

// TagsToFields transforms the Tags on the supplied context into zap fields.
func TagsToFields(ctx context.Context) []zapcore.Field {
Copy link
Contributor

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


// 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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor

@yifanzz yifanzz left a 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

}

// ToContext adds the zap.Logger to the context for extraction later.
// Returning the new context that has been created.
// Deprecated: use ctxzap.ToContext
Copy link
Contributor

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

@domgreen domgreen merged commit f7cbcd2 into grpc-ecosystem:master Feb 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants