This commit is contained in:
@@ -11,6 +11,8 @@ Python 3.7 as :mod:`contextvars`.
|
||||
.. versionchanged:: 21.1.0
|
||||
Reimplemented without using a single dict as context carrier for improved
|
||||
isolation. Every key-value pair is a separate `contextvars.ContextVar` now.
|
||||
.. versionchanged:: 23.3.0
|
||||
Callsite parameters are now also collected under asyncio.
|
||||
|
||||
See :doc:`contextvars`.
|
||||
"""
|
||||
@@ -20,6 +22,7 @@ from __future__ import annotations
|
||||
import contextlib
|
||||
import contextvars
|
||||
|
||||
from types import FrameType
|
||||
from typing import Any, Generator, Mapping
|
||||
|
||||
import structlog
|
||||
@@ -30,6 +33,10 @@ from .typing import BindableLogger, EventDict, WrappedLogger
|
||||
STRUCTLOG_KEY_PREFIX = "structlog_"
|
||||
STRUCTLOG_KEY_PREFIX_LEN = len(STRUCTLOG_KEY_PREFIX)
|
||||
|
||||
_ASYNC_CALLING_STACK: contextvars.ContextVar[FrameType] = (
|
||||
contextvars.ContextVar("_ASYNC_CALLING_STACK")
|
||||
)
|
||||
|
||||
# For proper isolation, we have to use a dict of ContextVars instead of a
|
||||
# single ContextVar with a dict.
|
||||
# See https://github.com/hynek/structlog/pull/302 for details.
|
||||
|
||||
Reference in New Issue
Block a user