-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Make level configurable for RedirectStdLog #508
Conversation
This change introduces a new function `RedirectStdLogAt`. It has the same behaviour as `RedirectStdLog` but allows providing a log level to be used by used `*log.Logger`.
Codecov Report
@@ Coverage Diff @@
## master #508 +/- ##
==========================================
+ Coverage 97.19% 97.22% +0.03%
==========================================
Files 37 37
Lines 2243 2272 +29
==========================================
+ Hits 2180 2209 +29
Misses 56 56
Partials 7 7
Continue to review full report at Codecov.
|
logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth)) | ||
var logFunc func(string, ...zapcore.Field) | ||
switch level { | ||
case DebugLevel: |
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.
I can imagine a levelToFunc
function here to DRY.
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.
Agreed! You've been patient enough, though - I'm happy to merge without that and fix it myself :)
@akshayjshah What do you think? |
@akshayjshah @billf bump. |
@akshayjshah @billf Is there anything I can help out with to get this PR through quicker? :-) |
No - I'm really sorry for the absurd delay. Family, work, etc. - reviewing now. |
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 good - I'm going to push a commit to DRY things up a bit, but looks good.
Sorry again for the super-long review delay.
logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth)) | ||
var logFunc func(string, ...zapcore.Field) | ||
switch level { | ||
case DebugLevel: |
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.
Agreed! You've been patient enough, though - I'm happy to merge without that and fix it myself :)
@akshayjshah Thanks guys! 🙇 and thanks for the good work on it. |
This change introduces a new function
RedirectStdLogAt
. It has the same behaviour asRedirectStdLog
but allows providing a log level to be used by used*log.Logger
.