-
Notifications
You must be signed in to change notification settings - Fork 353
refactor: replace logrus for global slog logger #889
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
Conversation
Co-authored-by: Florian Lehner <[email protected]>
1161c8b to
fc2c5f6
Compare
Co-authored-by: Christos Kalkanis <[email protected]>
Co-authored-by: Christos Kalkanis <[email protected]>
| globalLogger.Store(&l) | ||
| } | ||
|
|
||
| // SetDebugLogger configures the global logger to write debug-level logs to stderr. |
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.
Instead of SetDebugLogger an API should be provided to set the log level.
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.
The slog Handler does not provide any mechanism to change the log level in runtime, a new logger needs to be created instead. Any suggestion on the naming?
Also, keep in mind that this will be removed once we transition to just having the otel receiver (verbosity will be defined from the collector's configuration)
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.
In the example provided with slog.SetLogLoggerLevel, changing the severity level after setting the logger just works.
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.
That function only works in case we were using the default slog.Logger instance, in this case we created a new non default logger.
Co-authored-by: Florian Lehner <[email protected]>
Co-authored-by: Florian Lehner <[email protected]>
abcba37 to
64f9b21
Compare
|
@open-telemetry/ebpf-profiler-maintainers Anything left to be addressed? |
| lowAddress, highAddress, mapBase libpf.Address, stubTypeOrHdrMap uint64) { | ||
| lowAddress, highAddress, mapBase libpf.Address, stubTypeOrHdrMap uint64, | ||
| ) { |
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 PR has a ton of these unrelated stylistic changes. This makes rebasing other PRs really painful.
Please stop changing code unnecessarily.
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.
Sorry about that. Would it be fine for you if I create a specific PR to format all the Go code? Something like what we did in OpAMP-go and all other OpenTelemetry Go projects: open-telemetry/opamp-go#356
Most IDEs or editors configurations auto-format on save.
Adds a new internal package to initialize a global
sloglogger instance:internal/global/logging.go.It can be overridden anytime, like when used as a collector receiver, which uses a
zapadapter.The global package provides some adapter functions for minimal changes in the codebase (non-structured logging), we should aim (follow-up PR/issue) to gradually move to a structured logging strategy to benefit from
slog.This changes aligns the formatting when running with the OTel collector:
Fixes #417