You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/logger.md
+22-3Lines changed: 22 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -158,7 +158,7 @@ To ease routine tasks like extracting correlation ID from popular event sources,
158
158
You can append additional keys using either mechanism:
159
159
160
160
* Persist new keys across all future log messages via `append_keys` method
161
-
* Add additional keys on a per log message basis via `extra` parameter
161
+
* Add additional keys on a per log message basis as a keyword=value, or via `extra` parameter
162
162
163
163
#### append_keys method
164
164
@@ -184,14 +184,33 @@ You can append your own keys to your existing Logger via `append_keys(**addition
184
184
185
185
This example will add `order_id` if its value is not empty, and in subsequent invocations where `order_id` might not be present it'll remove it from the Logger.
186
186
187
+
#### ephemeral metadata
188
+
189
+
You can pass an arbitrary number of keyword arguments (kwargs) to all log level's methods, e.g. `logger.info, logger.warning`.
190
+
191
+
Two common use cases for this feature is to enrich log statements with additional metadata, or only add certain keys conditionally.
192
+
193
+
!!! info "Any keyword argument added will not be persisted in subsequent messages."
0 commit comments