src/structlog/threadlocal.py
def as_immutable(logger):
    """
    Extract the context from a thread local logger into an immutable logger.

    :param structlog.BoundLogger logger: A logger with *possibly* thread local
        state.
    :rtype: :class:`~structlog.BoundLogger` with an immutable context.
    """
    if isinstance(logger, BoundLoggerLazyProxy):
        logger = logger.bind()

    try:
        ctx = logger._context._tl.dict_.__class__(logger._context._dict)
        bl = logger.__class__(
            logger._logger, processors=logger._processors, context={}
        )
        bl._context = ctx
        return bl
    except AttributeError:
        return logger

    Extract the context from a thread local logger into an immutable logger.

    :param structlog.BoundLogger logger: A logger with *possibly* thread local
        state.
    :rtype: :class:`~structlog.BoundLogger` with an immutable context.
    
Extract the context from a thread local logger into an immutable logger.
Extract the context from a thread local logger into an immutable logger .
def as_immutable(logger):
    if isinstance(logger, BoundLoggerLazyProxy):
        logger = logger.bind()
    try:
        ctx = logger._context._tl.dict_.__class__(logger._context._dict)
        bl = logger.__class__(
            logger._logger, processors=logger._processors, context={}
        )
        bl._context = ctx
        return bl
    except AttributeError:
        return logger
def as_immutable ( logger ) : if isinstance ( logger , BoundLoggerLazyProxy ) : logger = logger . bind ( ) try : ctx = logger . _context . _tl . dict_ . __class__ ( logger . _context . _dict ) bl = logger . __class__ ( logger . _logger , processors = logger . _processors , context = { } ) bl . _context = ctx return bl except AttributeError : return logger
Extract the context from a thread local logger into an immutable logger.
Extract the context from a thread local logger into an immutable logger .
"""
    Extract the context from a thread local logger into an immutable logger.

    :param structlog.BoundLogger logger: A logger with *possibly* thread local
        state.
    :rtype: :class:`~structlog.BoundLogger` with an immutable context.
    """
None
:class:`~structlog.BoundLogger` with an immutable context.
logger
A logger with *possibly* thread local
state.
A logger with * possibly * thread local state .