-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add context and info to logging interface #237
Add context and info to logging interface #237
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #237 +/- ##
==========================================
+ Coverage 72.50% 72.60% +0.09%
==========================================
Files 25 25
Lines 2022 2022
==========================================
+ Hits 1466 1468 +2
+ Misses 446 445 -1
+ Partials 110 109 -1 ☔ View full report in Codecov by Sentry. |
Before i continue with this... @andykellr @evan-bradley @tigrannajaryan what do you all think of this approach? Propagating the context would make it easier for consumers to understand the potential problems that the impls run in to, but i'm not sure how i feel about the interface. Let me know your thoughts. Thank you. |
I have a hard time reviewing the code due to all the junk codecov added. I am going to disable it for now. |
The idea to pass the context to logging functions sounds good to me. I am not sure we need a separate set of functions for that. Perhaps just add context parameter to existing functions? |
@tigrannajaryan sounds good! I'll update to do that. |
One benefit to the current approach is that the interface matches the new Go structured logger, slog. Rather than adding context to the existing functions, it might make more sense to keep the context versions, and remove (or deprecate) the non-context versions. That way you can use any logger that is |
yeah that was the intended purpose... I see benefits for both approaches... i'll follow up in slack. |
The I prefer to keep Logger interface as small as possible and bridge to any other logging API as needed. Coding a bridge from We also do not have stability promises in this repo yet, so I am not too worried about making a breaking change that is very easy to adopt. I don't think we need a deprecations process for this. |
done! I will also work on the follow up described here which will make these even more valuable. |
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.
Mostly LGTM, except I think we don't need the Infof() for now. Can be added later when needed.
the codecov is failing for probably obvious reasons – testing error logs isn't really done right now |
This is a breaking change in the API, allowed because the API is not declared stable yet. |
Allow the logging interface to propagate context where possible. This will let logging sinks contain richer information about potential opamp IO errors.