-
Notifications
You must be signed in to change notification settings - Fork 923
Add context and severity params to ExtendedLogger#isEnabled #7268
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 severity params to ExtendedLogger#isEnabled #7268
Conversation
|
|
||
| /** Overload of {@link #isEnabled(Severity, Context)} assuming {@link Context#current()}. */ | ||
| default boolean isEnabled(Severity severity) { | ||
| return isEnabled(severity, Context.current()); |
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 spec says this should accept Severity and Context parameters, but since we have implicit context in java, I think the most common case will be to use that. So I've included an overload where the context is omitted.
| @Override | ||
| public boolean isEnabled() { | ||
| public boolean isEnabled(Severity severity, Context context) { | ||
| return loggerEnabled; |
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.
Unfortunately there's no way for the java SDK to currently respond to context or severity parameters today until we also implement LogRecordProcessor#isEnabled: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#logrecordprocessor-operations
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7268 +/- ##
=========================================
Coverage 89.82% 89.82%
- Complexity 6999 7002 +3
=========================================
Files 798 798
Lines 21199 21211 +12
Branches 2055 2055
=========================================
+ Hits 19042 19053 +11
Misses 1496 1496
- Partials 661 662 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Resolves #7242.
Also noticed that the noop implementations of isEnabled for traces, metrics, and logs were all returning true instead of false, so fixed that as well.