-
Notifications
You must be signed in to change notification settings - Fork 216
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
Minor logger improovments #1495
Minor logger improovments #1495
Conversation
|
@@ -57,7 +52,7 @@ type withLogger struct { | |||
} | |||
|
|||
func newWithLogger(logger Logger, keyvals ...interface{}) *withLogger { | |||
return &withLogger{logger: logger, keyvals: keyvals} | |||
return &withLogger{logger: Skip(logger, 1), keyvals: keyvals} |
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.
Just to confirm, this code path would only matter if the logger did not implement WithLogger
but did implement WithSkipCallers
?
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.
Yes, you right.
Skip
function will ignore logger in case it doesn't implement WithSkipCallers
interface
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.
hm I wonder how common this actually is, but in principle this change makes sense I think
What was changed
WithLogger
interface close to others (same package, different file)WithLogger
implementationWhy?
WithLogger
interface allow user to see all available interfaces in one place. It increase user experienceSkip
function to thewithLogger
constructor functions allows to skipwith_logger.go
from the stackChecklist