Skip to content

Commit c55ed5c

Browse files
authored
Define how SDK implements Logger.Enabled (#4381)
1 parent 7116ef8 commit c55ed5c

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ release.
1515

1616
### Logs
1717

18+
- Define how SDK implements `Logger.Enabled`.
19+
([#4381](https://github.com/open-telemetry/opentelemetry-specification/pull/4381))
20+
1821
### Baggage
1922

2023
### Resource

specification/logs/noop.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ linkTitle: No-Op
44

55
# Logs API No-Op Implementation
66

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

99
<details>
1010
<summary> Table of Contents </summary>
@@ -15,6 +15,7 @@ linkTitle: No-Op
1515
* [Logger Creation](#logger-creation)
1616
- [Logger](#logger)
1717
* [Emit LogRecord](#emit-logrecord)
18+
* [Enabled](#enabled)
1819

1920
<!-- tocstop -->
2021

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

5657
The No-Op `Logger` MUST allow
5758
for [emitting LogRecords](./api.md#emit-a-logrecord).
59+
60+
### Enabled
61+
62+
**Status**: [Development](../document-status.md)
63+
64+
MUST always return `false`.

specification/logs/sdk.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* [ForceFlush](#forceflush)
1717
- [Logger](#logger)
1818
* [LoggerConfig](#loggerconfig)
19+
* [Enabled](#enabled)
1920
- [Additional LogRecord interfaces](#additional-logrecord-interfaces)
2021
* [ReadableLogRecord](#readablelogrecord)
2122
* [ReadWriteLogRecord](#readwritelogrecord)
@@ -190,6 +191,18 @@ It consists of the following parameters:
190191
necessary for implementations to ensure that changes to `disabled` are
191192
immediately visible to callers of `Enabled`.
192193

194+
### Enabled
195+
196+
**Status**: [Development](../document-status.md)
197+
198+
`Enabled` MUST return `false` when:
199+
200+
- there are no registered [`LogRecordProcessors`](#logrecordprocessor),
201+
- `Logger` is disabled ([`LoggerConfig.disabled`](#loggerconfig) is `true`).
202+
203+
Otherwise, it SHOULD return `true`.
204+
It MAY return `false` to support additional optimizations and features.
205+
193206
## Additional LogRecord interfaces
194207

195208
In this document we refer to `ReadableLogRecord` and `ReadWriteLogRecord`, defined as follows.

0 commit comments

Comments
 (0)