-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add zaptest logger option to wrap zap.Option's #610
Add zaptest logger option to wrap zap.Option's #610
Conversation
Codecov Report
@@ Coverage Diff @@
## master #610 +/- ##
==========================================
+ Coverage 97.23% 97.38% +0.14%
==========================================
Files 40 40
Lines 2063 2102 +39
==========================================
+ Hits 2006 2047 +41
+ Misses 49 47 -2
Partials 8 8
Continue to review full report at Codecov.
|
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.
Thanks for the PR, @iaroslav-ciupin! This feature would be great. However, I'd rather not replicate each of the core zap
package's options. Instead, I'd rather have the zaptest
package provide a generic adapter for the base options:
- The
loggerOptions
struct should have a field ofzap.Option
s. - Add a function that converts any number of
zap.Option
s to a singlezaptest.Option
:
func WrapOptions(opts ...zap.Option) LoggerOption { ...implementation...}
- In
NewLogger
, we'd pass all the options on theloggerOptions
struct tozap.New
.
@akshayjshah Thank you for your reply! I've adjusted PR and proposal accordingly. Please have a look ;) |
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.
Looks great!
Add a wrapper that converts any `zap.Option` into a `zaptest.LoggerOption`.
Synopsis
This PR adds feature suggested in #609