-
Notifications
You must be signed in to change notification settings - Fork 535
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
Upgrade dskit and improve log.InitLogger function #2799
Conversation
6a1a4f7
to
058cbff
Compare
Signed-off-by: Yuri Nikolic <[email protected]>
058cbff
to
bae7aa7
Compare
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.
This looks good to me. Just one question about the stack depth change.
// add support for level based logging | ||
logger = level.NewFilter(logger, LevelFilter(cfg.LogLevel.String())) | ||
// use UTC timestamps and skip 5 stack frames. | ||
logger = kitlog.With(logger, "ts", kitlog.DefaultTimestampUTC, "caller", kitlog.Caller(5)) |
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.
What does it mean to change the call stack depth here? Do we now report a different line is doing the logging?
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.
Hi @zalegrala,
The reason for that is the implementation of dslog.NewGoKitWithWriter()
, that is now used to create the actual logger, and that replaces the “manual” creation that was used before.
I did a manual test to check the outcome and it prints the same source and line it used to print before my change.
I will prepare a Unit test that ensures the right thing is printed once I am back from PTO. I will also replace the usage of RateLimitedLogger
with the one from dskit
.
This PR has been automatically marked as stale because it has not had any activity in the past 60 days. |
What this PR does:
This PR upgrades
dskit
and usesdskit
'slog
package for the creation of the global logger.For the main in the
dskit
see grafana/dskit#359.Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]