diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dfa39488f8..5118cadb53d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ release. ### Logs +- Define how SDK implements `Logger.Enabled`. + ([#4381](https://github.com/open-telemetry/opentelemetry-specification/pull/4381)) + ### Baggage ### Resource diff --git a/specification/logs/noop.md b/specification/logs/noop.md index 6a1d8502106..b657f700115 100644 --- a/specification/logs/noop.md +++ b/specification/logs/noop.md @@ -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
Table of Contents @@ -15,6 +15,7 @@ linkTitle: No-Op * [Logger Creation](#logger-creation) - [Logger](#logger) * [Emit LogRecord](#emit-logrecord) + * [Enabled](#enabled) @@ -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 + +**Status**: [Development](../document-status.md) + +MUST always return `false`. diff --git a/specification/logs/sdk.md b/specification/logs/sdk.md index 73f7350e1ed..c77d412e519 100644 --- a/specification/logs/sdk.md +++ b/specification/logs/sdk.md @@ -16,6 +16,7 @@ * [ForceFlush](#forceflush) - [Logger](#logger) * [LoggerConfig](#loggerconfig) + * [Enabled](#enabled) - [Additional LogRecord interfaces](#additional-logrecord-interfaces) * [ReadableLogRecord](#readablelogrecord) * [ReadWriteLogRecord](#readwritelogrecord) @@ -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: + +- there are no registered [`LogRecordProcessors`](#logrecordprocessor), +- `Logger` is disabled ([`LoggerConfig.disabled`](#loggerconfig) is `true`). + +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.