MCPcopy Create free account
hub / github.com/hynek/structlog / bind_threadlocal

Function bind_threadlocal

src/structlog/threadlocal.py:299–310  ·  view source on GitHub ↗

Put keys and values into the thread-local context. Use this instead of :func:`~structlog.BoundLogger.bind` when you want some context to be global (thread-local). .. versionadded:: 19.2.0 .. deprecated:: 22.1.0

(**kw: Any)

Source from the content-addressed store, hash-verified

297
298
299def bind_threadlocal(**kw: Any) -> None:
300 """
301 Put keys and values into the thread-local context.
302
303 Use this instead of :func:`~structlog.BoundLogger.bind` when you want some
304 context to be global (thread-local).
305
306 .. versionadded:: 19.2.0
307 .. deprecated:: 22.1.0
308 """
309 _deprecated()
310 _get_context().update(kw)
311
312
313def unbind_threadlocal(*keys: str) -> None:

Callers 9

test_bind_and_mergeMethod · 0.90
test_clearMethod · 0.90
test_multiple_bindsMethod · 0.90
test_get_mergedMethod · 0.90
test_cleanup_conflictMethod · 0.90
wrappedMethod · 0.90
bound_threadlocalFunction · 0.85

Calls 3

_deprecatedFunction · 0.85
_get_contextFunction · 0.85
updateMethod · 0.80

Tested by 8

test_bind_and_mergeMethod · 0.72
test_clearMethod · 0.72
test_multiple_bindsMethod · 0.72
test_get_mergedMethod · 0.72
test_cleanup_conflictMethod · 0.72
wrappedMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…