fix: Logger.Enabled() #4011
Conversation
…y-cpp into fix-respect-severity
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4011 +/- ##
==========================================
+ Coverage 82.06% 82.08% +0.03%
==========================================
Files 385 385
Lines 15891 15978 +87
==========================================
+ Hits 13039 13114 +75
- Misses 2852 2864 +12
🚀 New features to boost your workflow:
|
Yes. The spec in "development" status means some changes are still possible before it reaches a stable state. SDK like opentelemetry-cpp needs to implement these specs early (so, now), to discover possible issues with the spec, so it can be adjusted if needed before reaching the stable status. Thanks for the contribution. |
…y-cpp into fix-respect-severity
| // YAML-NODE: SeverityNumber | ||
| enum class SeverityNumber : std::uint8_t | ||
| { | ||
| unspecified = 0, |
There was a problem hiding this comment.
current code default is trace. if this is intended, I will rollback to current code.
|
@proost Thanks for the PR! Both the LoggerConfig and YAML parsing/building features are very much needed :) The PR has grown a bit beyond the initial issue. To facilitate review please break out the yaml config parsing to a separate PR as follow up to this one. |
03e3214 to
22c01e3
Compare
|
@proost - Thanks for fixing the earlier I think the same concern still matters for For example: if (logger->Enabled(Severity::kDebug)) {
// allocate/build expensive debug log payload
}When debug logging is disabled, applications should pay as little as possible here. Previously this was just the Can we preserve the severity-only fast path for @ThomsonTan - Can you have a quick look on this PR too. Thanks. |
Fixes #2667
Changes
fix to
Logger.Enabled()use severity. so it changes to default behavior that enabled all logs to emit.I fix it as minimal what original issue mentioned. But the issue reported two years ago, spec is changed.
do I need to follow "DEVELOPMENT" status spec?(https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#enabled)
I think adding features to "LoggerConfig" is correct to me(default behavior can be annoyed because all logs enabled). But this is my first time, so I don't know what is rule in this project.
For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes