Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

bakins
Copy link
Contributor

@bakins bakins commented Oct 16, 2017

This allows setting zap fields on the logger that persist. zap.fields ensure type safety on the fields.

@bakins bakins force-pushed the set-zap-fields-directly branch from 01fee58 to a2505f0 Compare October 16, 2017 12:22
@codecov-io
Copy link

codecov-io commented Oct 16, 2017

Codecov Report

Merging #91 into master will increase coverage by 0.8%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #91     +/-   ##
=========================================
+ Coverage   75.61%   76.42%   +0.8%     
=========================================
  Files          34       34             
  Lines        1218     1247     +29     
=========================================
+ Hits          921      953     +32     
+ Misses        249      245      -4     
- Partials       48       49      +1
Impacted Files Coverage Δ
logging/zap/context.go 100% <100%> (ø) ⬆️
logging/logrus/context.go 100% <100%> (ø) ⬆️
tags/options.go 100% <0%> (ø) ⬆️
tags/interceptors.go 88.88% <0%> (+0.31%) ⬆️
logging/zap/payload_interceptors.go 84.61% <0%> (+4.61%) ⬆️

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 6d3547c...adf7b3c. Read the comment docs.

@mwitkow
Copy link
Member

mwitkow commented Oct 20, 2017

Can you please add a symmetric function to the Logrus one then? :)

@bakins
Copy link
Contributor Author

bakins commented Oct 25, 2017

@mwitkow - I added AddFields to logrus as well.

@mwitkow mwitkow merged commit 88744e2 into grpc-ecosystem:master Nov 4, 2017
johanbrandhorst added a commit that referenced this pull request Dec 23, 2024
* logging: add AddFields

Support the similar helpers from the v1 introduced in #91:
- [ctxzap.AddFields](https://github.com/grpc-ecosystem/go-grpc-middleware/blob/v1/logging/zap/ctxzap/context.go#L23-L32)
- [ctxlogrus.AddFields](https://github.com/grpc-ecosystem/go-grpc-middleware/blob/v1/logging/logrus/ctxlogrus/context.go#L22-L30)
- [ctxkit.AddFields](https://github.com/grpc-ecosystem/go-grpc-middleware/blob/v1/logging/kit/ctxkit/context.go#L22-L28)

Signed-off-by: Olivier Cano <[email protected]>

* Update interceptors/logging/logging.go

Co-authored-by: Johan Brandhorst-Satzkorn <[email protected]>

---------

Signed-off-by: Olivier Cano <[email protected]>
Co-authored-by: Johan Brandhorst-Satzkorn <[email protected]>
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