
    "hE6                       U d Z ddlmZ ddlZddlZddlZddlmZmZm	Z	m
Z
mZmZ ddlmZ ddlmZ ddlmZ dd	lmZmZmZ dd
lmZmZmZ ddlmZmZmZmZ 	 ee e       e edd       eej>                  jA                  dd      dk(  xrd ej>                  jA                  dd      dk7  xsC exr? ejB                  duxr/  e"ejB                  d      xr ejB                  jG                               gZ$de%d<    eee   e&      Z' ed      Z( e       Z)dZ* G d d      Z+ e+       Z,	 d!dZ-d"dZ.d#dZ/e/Z0	 	 	 	 	 	 d$	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d%dZ1	 	 	 	 	 d$	 	 	 	 	 	 	 	 	 	 	 d&dZ2	 	 	 	 	 d$	 	 	 	 	 	 	 	 	 	 	 d&dZ3d'dZ4 G d d       Z5y)(zJ
Global state department.  Don't reload this module or everything breaks.
    )annotationsN)AnyCallableIterableSequenceTypecast   )make_filtering_bound_logger)PrintLoggerFactory)merge_contextvars)ConsoleRenderer_has_colorsset_exc_info)StackInfoRendererTimeStamperadd_log_level)BindableLoggerContext	ProcessorWrappedLoggerz%Y-%m-%d %H:%M:%SF)fmtutcNO_COLOR FORCE_COLORisatty)colorszSequence[Processor]_BUILTIN_DEFAULT_PROCESSORSc                  l    e Zd ZU dZdZded<   edd Zded<   eZ	ded	<   e
Zd
ed<   eZded<   eZded<   y)_Configurationz
    Global defaults.
    Fboolis_configuredNzIterable[Processor]default_processorsztype[Context]default_context_classr   default_wrapper_classzCallable[..., WrappedLogger]logger_factorycache_logger_on_first_use)__name__
__module____qualname____doc__r#   __annotations__r   r$   _BUILTIN_DEFAULT_CONTEXT_CLASSr%   _BUILTIN_DEFAULT_WRAPPER_CLASSr&   _BUILTIN_DEFAULT_LOGGER_FACTORYr'   "_BUILTIN_CACHE_LOGGER_ON_FIRST_USEr(        N/var/www/html/sandstorm/venv/lib/python3.12/site-packages/structlog/_config.pyr!   r!   9   sX      M4.I!.L+L+I=I!?3?' 0  'ItHr3   r!   c                 "    t         j                  S )z
    Return whether *structlog* has been configured.

    If `False`, *structlog* is running with builtin defaults.

    .. versionadded: 18.1.0
    )_CONFIGr#   r2   r3   r4   r#   r#   N   s        r3   c                     t         j                  t         j                  t         j                  t         j                  t         j
                  dS )z
    Get a dictionary with the current configuration.

    .. note::

       Changes to the returned dictionary do *not* affect *structlog*.

    .. versionadded: 18.1.0
    )
processorscontext_classwrapper_classr'   r(   )r6   r$   r%   r&   r'   r(   r2   r3   r4   
get_configr;   Y   s;     00 66 66!00%,%F%F r3   c                     t        dd| i|S )ak  
    Convenience function that returns a logger according to configuration.

    >>> from structlog import get_logger
    >>> log = get_logger(y=23)
    >>> log.info("hello", x=42)
    y=23 x=42 event='hello'

    Args:
        args:
            *Optional* positional arguments that are passed unmodified to the
            logger factory.  Therefore it depends on the factory what they
            mean.

        initial_values: Values that are used to pre-populate your contexts.

    Returns:
        A proxy that creates a correctly configured bound logger when
        necessary. The type of that bound logger depends on your configuration
        and is `structlog.BoundLogger` by default.

    See `configuration` for details.

    If you prefer CamelCase, there's an alias for your reading pleasure:
    `structlog.getLogger`.

    .. versionadded:: 0.4.0 *args*
    logger_factory_argsN)wrap_logger)argsinitial_valuess     r4   
get_loggerrB   l   s    : HHHHr3   c           	     &    t        | ||||||      S )aC  
    Create a new bound logger for an arbitrary *logger*.

    Default values for *processors*, *wrapper_class*, and *context_class* can
    be set using `configure`.

    If you set an attribute here, `configure` calls have *no* effect for the
    *respective* attribute.

    In other words: selective overwriting of the defaults while keeping some
    *is* possible.

    Args:
        initial_values: Values that are used to pre-populate your contexts.

        logger_factory_args:
            Values that are passed unmodified as ``*logger_factory_args`` to
            the logger factory if not `None`.

    Returns:
        A proxy that creates a correctly configured bound logger when
        necessary.

    See `configure` for the meaning of the rest of the arguments.

    .. versionadded:: 0.4.0 *logger_factory_args*
    )r:   r8   r9   r(   rA   r=   )BoundLoggerLazyProxy)loggerr8   r:   r9   r(   r=   rA   s          r4   r?   r?      s'    H  ##";%/ r3   c                    dt         _        | | t         _        ||t         _        ||t         _        ||t         _        ||t         _        yy)a  
    Configures the **global** defaults.

    They are used if `wrap_logger` or `get_logger` are called without
    arguments.

    Can be called several times, keeping an argument at `None` leaves it
    unchanged from the current setting.

    After calling for the first time, `is_configured` starts returning `True`.

    Use `reset_defaults` to undo your changes.

    Args:
        processors: The processor chain. See :doc:`processors` for details.

        wrapper_class:
            Class to use for wrapping loggers instead of
            `structlog.BoundLogger`.  See `standard-library`, :doc:`twisted`,
            and `custom-wrappers`.

        context_class:
            Class to be used for internal context keeping. The default is a
            `dict` and since dictionaries are ordered as of Python 3.6, there's
            few reasons to change this option.

        logger_factory:
            Factory to be called to create a new logger that shall be wrapped.

        cache_logger_on_first_use:
            `wrap_logger` doesn't return an actual wrapped logger but a proxy
            that assembles one when it's first used. If this option is set to
            `True`, this assembled logger is cached. See `performance`.

    .. versionadded:: 0.3.0 *cache_logger_on_first_use*
    TN)r6   r#   r$   r&   r%   r'   r(   r8   r:   r9   r'   r(   s        r4   	configurerH      sX    V !G%/" (5% (5%!!/ ,,E) -r3   c                ~    t         j                  st        | ||||       yt        j                  dt
        d       y)z
    Configures if structlog isn't configured yet.

    It does *not* matter whether it was configured using `configure` or
    `configure_once` before.

    Raises:
        RuntimeWarning: if repeated configuration is attempted.
    rG   z!Repeated configuration attempted.   )
stacklevelN)r6   r#   rH   warningswarnRuntimeWarningrG   s        r4   configure_oncerO      s9        !'')&?	
 	/A	
r3   c                     dt         _        t        dd t         _        t        t         _        t        t         _        t        t         _	        t        t         _        y)zu
    Resets global default values to builtin defaults.

    `is_configured` starts returning `False` afterwards.
    FN)r6   r#   r   r$   r/   r&   r.   r%   r0   r'   r1   r(   r2   r3   r4   reset_defaultsrQ     s9     "G!<Q!?G$BG!$BG!<G(JG%r3   c                      e Zd ZdZedd       Z	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddZddZ	ddZ
dd	Zdd
ZddZddZy)rD   a  
    Instantiates a bound logger on first usage.

    Takes both configuration and instantiation parameters into account.

    The only points where a bound logger changes state are ``bind()``,
    ``unbind()``, and ``new()`` and that return the actual ``BoundLogger``.

    If and only if configuration says so, that actual bound logger is cached on
    first usage.

    .. versionchanged:: 0.4.0 Added support for *logger_factory_args*.
    c                    | j                   S r>   )_initial_valuesselfs    r4   _contextzBoundLoggerLazyProxy._context9  s    ###r3   Nc                v    || _         || _        || _        || _        || _        |xs i | _        |xs d| _        y )Nr2   )_logger_wrapper_class_processors_context_class_cache_logger_on_first_userT   _logger_factory_args)rV   rE   r:   r8   r9   r(   rA   r=   s           r4   __init__zBoundLoggerLazyProxy.__init__=  sE     +%+*C'-3$7$=2!r3   c                    d| j                   d| j                  d| j                  d| j                  d| j                  d| j
                  dS )Nz<BoundLoggerLazyProxy(logger=z, wrapper_class=z, processors=z, context_class=z, initial_values=z, logger_factory_args=z)>)rY   rZ   r[   r\   rT   r^   rU   s    r4   __repr__zBoundLoggerLazyProxy.__repr__O  sk    +DLL+;;K""%]43C3C2F G!003 4"225 6##'#<#<"?r	C	
r3   c                   | j                   r| j                  | j                        }nt        j                  | j                        }| j                  }|st        j
                  | j                   }| j                  t        j                  }n| j                  }| j                  xs t        j                  } ||||      dfd}| j                  du s| j                  t        j                  du r|| _         |di |S )zN
        Assemble a new BoundLogger from arguments and configuration.
        )r8   contextc                 0    | r j                   di | S S )zU
            Use cached assembled logger to bind potentially new values.
            r2   )bind)
new_valuesrE   s    r4   finalized_bindz1BoundLoggerLazyProxy.bind.<locals>.finalized_binds  s!     "v{{0Z00Mr3   Trf   r   returnr   r2   )r\   rT   r6   r%   rY   r'   r^   r[   r$   rZ   r&   r]   r(   re   )rV   rf   ctxrY   procsclsrg   rE   s          @r4   re   zBoundLoggerLazyProxy.bindX  s     %%d&:&:;C//0D0DEC,,,,d.G.GHG#..E$$E!!BW%B%B 
	 **d2++311T9&DI+
++r3   c                <     | j                         j                  | S )zs
        Same as bind, except unbind *keys* first.

        In our case that could be only initial values.
        )re   unbindrV   keyss     r4   rn   zBoundLoggerLazyProxy.unbind  s     "tyy{!!4((r3   c                <     | j                         j                  | S r>   )re   
try_unbindro   s     r4   rr   zBoundLoggerLazyProxy.try_unbind  s    %tyy{%%t,,r3   c                    | j                   r| j                         j                          n"t        j                         j                           | j                  di |S )z+
        Clear context, then bind.
        r2   )r\   clearr6   r%   re   )rV   rf   s     r4   newzBoundLoggerLazyProxy.new  sK     !'')))+113tyy&:&&r3   c                P    |dk(  rt         | j                         }t        ||      S )zz
        If a logging method if called on a lazy proxy, we have to create an
        ephemeral BoundLogger first.
        __isabstractmethod__)AttributeErrorre   getattr)rV   namebls      r4   __getattr__z BoundLoggerLazyProxy.__getattr__  s+    
 ))  YY[r4  r3   c                    | j                   S )=
        Our __getattr__ magic makes this necessary.
        )__dict__rU   s    r4   __getstate__z!BoundLoggerLazyProxy.__getstate__  s     }}r3   c                N    |j                         D ]  \  }}t        | ||        y)r~   N)itemssetattr)rV   statekvs       r4   __setstate__z!BoundLoggerLazyProxy.__setstate__  s)     KKM 	 DAqD!Q	 r3   )ri   zdict[str, str])NNNNNN)rE   WrappedLogger | Noner:   type[BindableLogger] | Noner8   Iterable[Processor] | Noner9   type[Context] | Noner(   bool | NonerA   zdict[str, Any] | Noner=   r   ri   None)ri   strrh   )rp   r   ri   r   )rz   r   ri   r   ri   dict[str, Any])r   r   ri   r   )r)   r*   r+   r,   propertyrW   r_   ra   re   rn   rr   ru   r|   r   r   r2   r3   r4   rD   rD   )  s     $ $ 6:15.21504#'>$> 3> /	>
 ,> $/> .> !> 
>$
*,X)-	'
! r3   rD   )ri   r"   r   )r@   r   rA   r   ri   r   )NNNNN)rE   r   r8   r   r:   r   r9   r   r(   r   r=   zIterable[Any] | NonerA   r   ri   r   )r8   r   r:   r   r9   r   r'   z#Callable[..., WrappedLogger] | Noner(   r   ri   r   )ri   r   )6r,   
__future__r   ossysrL   typingr   r   r   r   r   r	   _nativer   _outputr   contextvarsr   devr   r   r   r8   r   r   r   r   r   r   r   environgetstdouthasattrr   r   r-   dictr.   r/   r0   r1   r!   r6   r#   r;   rB   	getLoggerr?   rH   rO   rQ   rD   r2   r3   r4   <module>r      sf   # 	 
  @ @ 0 ' * ; ; E E E E 'U3zz~~j"-3 	
JJNN="-3  (JJd*(CJJ1( JJ%%'4 0 & "&d7mT!: !<Q!? "4"6 %* "I I 

!&I@ 	 .215*.-104, ,*, /, (	,
  +, ., , 	,` .215*.:>-16F*6F.6F (6F 8	6F
  +6F 
6Ft .215*.:>-1
*
.
 (
 8	

  +
 

<KH  H r3   