A processor that merges in a global (thread-local) context. Use this as your first processor in :func:`structlog.configure` to ensure thread-local context is included in all log calls. .. versionadded:: 19.2.0 .. versionchanged:: 20.1.0 This function used to be called
(
logger: WrappedLogger, method_name: str, event_dict: EventDict
)
| 255 | |
| 256 | |
| 257 | def merge_threadlocal( |
| 258 | logger: WrappedLogger, method_name: str, event_dict: EventDict |
| 259 | ) -> EventDict: |
| 260 | """ |
| 261 | A processor that merges in a global (thread-local) context. |
| 262 | |
| 263 | Use this as your first processor in :func:`structlog.configure` to ensure |
| 264 | thread-local context is included in all log calls. |
| 265 | |
| 266 | .. versionadded:: 19.2.0 |
| 267 | |
| 268 | .. versionchanged:: 20.1.0 |
| 269 | This function used to be called ``merge_threadlocal_context`` and that |
| 270 | name is still kept around for backward compatibility. |
| 271 | |
| 272 | .. deprecated:: 22.1.0 |
| 273 | """ |
| 274 | _deprecated() |
| 275 | context = _get_context().copy() |
| 276 | context.update(event_dict) |
| 277 | |
| 278 | return context |
| 279 | |
| 280 | |
| 281 | # Alias that shouldn't be used anymore. |
searching dependent graphs…