-
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
Logger: add Log method #1118
Logger: add Log method #1118
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1118 +/- ##
==========================================
- Coverage 98.36% 98.32% -0.05%
==========================================
Files 49 49
Lines 2145 2147 +2
==========================================
+ Hits 2110 2111 +1
- Misses 27 28 +1
Partials 8 8
Continue to review full report at Codecov.
|
sugar.go
Outdated
if ce := s.base.Check(lvl, msg); ce != nil { | ||
ce.Write(s.sweetenFields(context)...) | ||
} | ||
s.base.Log(lvl, msg, s.sweetenFields(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.
I would revert this and the other change in this file.
The Check version has the advantage that we don't spend CPU on sweetenFields
unless we're actually going to log the message. So if the log level is too low or the message gets sampled, we won't pay to serialize the fields.
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.
Ah, that is a good point. Thank you! Reverted.
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! |
Unfortunately I don't see how this could be used internally without breaking caller skip.
Resolve #1084.