Skip to content

Commit

Permalink
Add Enabled section to Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed May 17, 2024
1 parent f85fe4d commit 770bc05
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions specification/logs/bridge-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ The `Logger` MUST provide functions to:

- Emit a `LogRecord`

The `Logger` SHOULD provide functions to:

- Report if `Enabled` for a `LogRecord`

#### Emit a LogRecord

The effect of calling this API is to emit a `LogRecord` to the processing pipeline.
Expand All @@ -127,6 +131,30 @@ The API MUST accept the following parameters:

All parameters are optional.

#### Enabled

To help users avoid performing computationally expensive operations when
generating a `LogRecord`, a `Logger` SHOULD provide this `Enabled` API.

At a minimum, the API MUST accept the following parameters:

- [Context](../context/README.md) (optional): This is the Context associated
with the `LogRecord`. The API MAY implicitly use the current Context as a
default behavior.
- [Severity Number](./data-model.md#field-severitynumber)

Users of a language implementation community can have specific needs when using
this API. Therefore, additional parameters MAY be accepted.

This API MUST return a language idiomatic boolean type.

The returned value MUST be `true` when logging is enabled for the provided
arguments. The returned value can be `true` or `false` when logging is disabled
for the provided arguments. The ambiguity when disabled allows implementation
that want to optimize memory or handle indeterminable states the flexibility
they need. If an implementation does not need this flexibility, it SHOULD
return `false` when logging is disabled for the provided arguments.

## Optional and required parameters

The operations defined include various parameters, some of which are marked
Expand Down

0 comments on commit 770bc05

Please sign in to comment.