Skip to content

Commit 2f7e5b0

Browse files
authored
[logger] Document runtime_tag_levels configuration option (#5444)
1 parent ed36436 commit 2f7e5b0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

content/components/logger.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ logger:
3535
- **logs** (*Optional*, mapping): Manually set the log level for a
3636
specific component or tag. See [Manual Log Levels for more information](#logger-manual_tag_specific_levels).
3737

38+
- **runtime_tag_levels** (*Optional*, boolean): Enable runtime per-tag log level changes. This is automatically enabled
39+
when `logs` is configured or when `logger.set_level` is used with a `tag` parameter. Only needs to be manually
40+
enabled if calling `set_log_level()` from a lambda or external component. Defaults to `false` (auto-enabled as needed).
41+
3842
- **id** (*Optional*, [ID](#config-id)): Manually specify the ID used for code generation.
3943

4044
Advanced settings:
@@ -174,6 +178,10 @@ logger:
174178
mqtt.client: ERROR
175179
```
176180

181+
> [!NOTE]
182+
> When using `logs`, runtime per-tag log level support is automatically enabled. When this feature is disabled
183+
> (the default when `logs` is not configured), the logger is optimized for better performance and reduced memory usage.
184+
177185
The `level` option controls which log statements are included in the
178186
firmware. You cannot set a tag to a more detailed level than
179187
the global one, because log statements with lower severity than that level are not compiled in.
@@ -238,6 +246,11 @@ on_...:
238246
tag: mqtt.client
239247
```
240248

249+
> [!NOTE]
250+
> When using `logger.set_level` with a `tag` parameter, runtime per-tag log level support is automatically enabled.
251+
> If you need to call `set_log_level()` directly from a lambda or external component, you must manually enable
252+
> `runtime_tag_levels: true` in the logger configuration.
253+
241254
## Logger Automation
242255

243256
{{< anchor "logger-on_message" >}}

0 commit comments

Comments
 (0)