Skip to content
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

Define how SDK implements Logger.Enabled #4381

Merged
merged 20 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ release.

### Logs

- Define how SDK implements `Logger.Enabled`.
([#4381](https://github.com/open-telemetry/opentelemetry-specification/pull/4381))

### Baggage

### Resource
Expand Down
9 changes: 8 additions & 1 deletion specification/logs/noop.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ linkTitle: No-Op

# Logs API No-Op Implementation

**Status**: [Stable](../document-status.md)
**Status**: [Stable](../document-status.md), except where otherwise specified

<details>
<summary> Table of Contents </summary>
Expand All @@ -15,6 +15,7 @@ linkTitle: No-Op
* [Logger Creation](#logger-creation)
- [Logger](#logger)
* [Emit LogRecord](#emit-logrecord)
* [Enabled](#enabled)

<!-- tocstop -->

Expand Down Expand Up @@ -55,3 +56,9 @@ return the same `Logger` instances to all creation requests.

The No-Op `Logger` MUST allow
for [emitting LogRecords](./api.md#emit-a-logrecord).

### Enabled
carlosalberto marked this conversation as resolved.
Show resolved Hide resolved

**Status**: [Development](../document-status.md)

MUST always returns `false`.
pellared marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 13 additions & 0 deletions specification/logs/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* [ForceFlush](#forceflush)
- [Logger](#logger)
* [LoggerConfig](#loggerconfig)
* [Enabled](#enabled)
- [Additional LogRecord interfaces](#additional-logrecord-interfaces)
* [ReadableLogRecord](#readablelogrecord)
* [ReadWriteLogRecord](#readwritelogrecord)
Expand Down Expand Up @@ -190,6 +191,18 @@ It consists of the following parameters:
necessary for implementations to ensure that changes to `disabled` are
immediately visible to callers of `Enabled`.

### Enabled

**Status**: [Development](../document-status.md)

`Enabled` MUST return `false` when:
cijothomas marked this conversation as resolved.
Show resolved Hide resolved

- there is none registered [`LogRecordProcessor`](#logrecordprocessor),
pellared marked this conversation as resolved.
Show resolved Hide resolved
- `Logger` is disabled ([`LoggerConfig.disabled`](#loggerconfig) is `true`).
reyang marked this conversation as resolved.
Show resolved Hide resolved

Otherwise, it SHOULD return `true`.
It MAY return `false` to support additional optimizations and features.

## Additional LogRecord interfaces

In this document we refer to `ReadableLogRecord` and `ReadWriteLogRecord`, defined as follows.
Expand Down
Loading