Skip to content

feat(api-logs, sdk-logs)!: add Logger#enabled method#6371

Open
david-luna wants to merge 4 commits intoopen-telemetry:mainfrom
david-luna:add-logger-enabled
Open

feat(api-logs, sdk-logs)!: add Logger#enabled method#6371
david-luna wants to merge 4 commits intoopen-telemetry:mainfrom
david-luna:add-logger-enabled

Conversation

@david-luna
Copy link
Contributor

@david-luna david-luna commented Feb 4, 2026

Which problem is this PR solving?

Closes #6351

Added as a breaking change since anyone implementing this interface now must to implement the new method.

Short description of the changes

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit tests

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.48%. Comparing base (885fb67) to head (073c3dc).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6371   +/-   ##
=======================================
  Coverage   95.48%   95.48%           
=======================================
  Files         363      363           
  Lines       11563    11569    +6     
  Branches     2669     2669           
=======================================
+ Hits        11041    11047    +6     
  Misses        522      522           
Files with missing lines Coverage Δ
experimental/packages/api-logs/src/NoopLogger.ts 100.00% <100.00%> (ø)
experimental/packages/api-logs/src/ProxyLogger.ts 89.47% <100.00%> (+1.23%) ⬆️
experimental/packages/sdk-logs/src/Logger.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@david-luna david-luna changed the title feat(api-lods, sdk-logs): add Logger#enabled method feat(api-logs, sdk-logs): add Logger#enabled method Feb 5, 2026
@david-luna david-luna marked this pull request as ready for review February 5, 2026 09:25
@david-luna david-luna requested review from a team as code owners February 5, 2026 09:25
@david-luna david-luna added this to the Logs API/SDK GA milestone Feb 5, 2026
@david-luna david-luna changed the title feat(api-logs, sdk-logs): add Logger#enabled method feat(api-logs, sdk-logs)!: add Logger#enabled method Feb 5, 2026
/**
* Tells if the logger is enabled for the given context, severity number and event
* name if provided. The context details to the active one
* TODO: check in the spec what means implicit/explicit context support
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for reviewer: this TODO is also to discuss about the params of this method. The current implementations of Logger (NopLogger and Logger form the logs SDK) do not seem to need the params but I think with these params the spec allows to have loggers that my filter for a specific event, log level or context

severityNumber?: SeverityNumber;
eventName?: string;
}): boolean {
return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: we do actually have this property _loggerConfig (experimental feature) that allows users to disable certain loggers based on severity number, name of the logger and trace sampling decision - I think we'd need to read this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[api-logs, sdk-logs] implement Logger#enabled

2 participants

Comments