
    "h                    d   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 ddl	m
Z
 ddlmZmZmZmZmZmZmZmZ ddlmZ dd	lmZ dd
ZddZ	 	 	 	 	 	 	 	 	 	 ddZ	 	 	 	 	 	 	 	 	 	 ddZ	 	 	 	 ddZddZ ee      Z ee      Z ee      Z ee      Z ee      Z  ee      Z!ee!ee eeeeeeeeiZ"y)z.
structlog's native high-performance loggers.
    )annotationsN)AnyCallable   )BoundLoggerBase)CRITICALDEBUGERRORINFOLEVEL_TO_NAMENAME_TO_LEVELNOTSETWARNING)_ASYNC_CALLING_STACK)FilteringBoundLoggerc                     y N selfeventargskws       N/var/www/html/sandstorm/venv/lib/python3.12/site-packages/structlog/_native.py_nopr   !   s        c                   K   y wr   r   r   s       r   _anopr   %   s	     s   c                R    |j                  dd        | j                  |g|i |S )Nexc_infoT)
setdefaulterrorr   s       r   	exceptionr#   )   s-     MM*d#4::e)d)b))r   c                   K   j                  dd      du rt        j                         d<   t        j                  t        j
                         j                        }t        j                         	 t        j                         j                  d fd       d{   }t        j                  |       |S 7 # t        j                  |       w xY ww)ze
    .. versionchanged:: 23.3.0
       Callsite parameters are now also collected under asyncio.
    r    TNc                 2    j                   fd      S )Nc                 0     j                   g i S r   )r"   )r   r   r   r   s   r   <lambda>z.aexception.<locals>.<lambda>.<locals>.<lambda>B   s    JDJJu$Bt$Br$B r   run)r   ctxr   r   r   s   r   r'   zaexception.<locals>.<lambda>B   s    CGGBC r   )getsysr    r   set	_getframef_backcontextvarscopy_contextasyncioget_running_looprun_in_executorreset)r   r   r   r   	scs_tokenrunnerr*   s   ````  @r   
aexceptionr8   1   s      
vvj$4':$(()?)?@I

"
"
$C.//1AAC
 

 	""9-M

 	""9-s0   A1C9.C 'C(C ,CC CCc                b    t        | t              rt        | j                            } t        |    S )aP  
    Create a new `FilteringBoundLogger` that only logs *min_level* or higher.

    The logger is optimized such that log levels below *min_level* only consist
    of a ``return None``.

    All familiar log methods are present, with async variants of each that are
    prefixed by an ``a``. Therefore, the async version of ``log.info("hello")``
    is ``await log.ainfo("hello")``.

    Additionally it has a ``log(self, level: int, **kw: Any)`` method to mirror
    `logging.Logger.log` and `structlog.stdlib.BoundLogger.log`.

    Compared to using *structlog*'s standard library integration and the
    `structlog.stdlib.filter_by_level` processor:

    - It's faster because once the logger is built at program start; it's a
      static class.
    - For the same reason you can't change the log level once configured. Use
      the dynamic approach of `standard-library` instead, if you need this
      feature.
    - You *can* have (much) more fine-grained filtering by :ref:`writing a
      simple processor <finer-filtering>`.

    Args:
        min_level:
            The log level as an integer. You can use the constants from
            `logging` like ``logging.INFO`` or pass the values directly. See
            `this table from the logging docs
            <https://docs.python.org/3/library/logging.html#levels>`_ for
            possible values.

            If you pass a string, it must be one of: ``critical``, ``error``,
            ``warning``, ``info``, ``debug``, ``notset`` (upper/lower case
            doesn't matter).

    .. versionadded:: 20.2.0
    .. versionchanged:: 21.1.0 The returned loggers are now pickleable.
    .. versionadded:: 20.1.0 The ``log()`` method.
    .. versionadded:: 22.2.0
       Async variants ``alog()``, ``adebug()``, ``ainfo()``, and so forth.
    .. versionchanged:: 25.1.0 *min_level* can now be a string.
    )
isinstancestrr   lowerLEVEL_TO_FILTERING_LOGGER)	min_levels    r   make_filtering_bound_loggerr?   J   s+    \ )S!!)//"34	$Y//r   c                    	 	 	 	 d fd}d fd}	 	 	 	 	 	 	 	 	 	 	 	 d fd}||d}t        j                         D ]  \  }} ||      \  ||<   |d| <    t        |d<   t        |d<   |d   |d	<   |d
   |d<   |d   |d<   |d   |d<   |d   |d<   |d   |d<    fd|d<    fd|d<   t	        dt        j
                   d      j                          t        f|      S )z
    Create a new `FilteringBoundLogger` that only logs *min_level* or higher.

    The logger is optimized such that log levels below *min_level* only consist
    of a ``return None``.
    c                |    | k  rt         t        fS t        |    dfd}dfd}|_        d |_        ||fS )Nc                ^    |s | j                   |fi |S  | j                   ||z  fi |S r   _proxy_to_logger)r   r   r   r   names       r   methz?_make_filtering_bound_logger.<locals>.make_method.<locals>.meth   s>    ,t,,T5?B??(4((ut|BrBBr   c                x   K   |r|z  t        j                  t        j                         j                        }t        j                         	 t        j                         j                  d fd       d{    t        j                  |       y7 # t        j                  |       w xY ww)z}
            .. versionchanged:: 23.3.0
               Callsite parameters are now also collected under asyncio.
            Nc                 2     j                  fd      S )Nc                 ,     j                    fi S r   rC   r   r   rE   r   s   r   r'   zd_make_filtering_bound_logger.<locals>.make_method.<locals>.ameth.<locals>.<lambda>.<locals>.<lambda>   s     5 5 5dE HR H r   r(   r*   r   r   rE   r   s   r   r'   zR_make_filtering_bound_logger.<locals>.make_method.<locals>.ameth.<locals>.<lambda>   s    CGGH r   )r   r-   r,   r.   r/   r0   r1   r2   r3   r4   r5   )r   r   r   r   r6   r*   rE   s   `` ` @r   amethz@_make_filtering_bound_logger.<locals>.make_method.<locals>.ameth   s     
 ,001G1GHI**,C6..0@@   %**95 %**95s0   AB:.B  BB  B:B   B77B:a
r   r   r   r;   r   r   r   r   returnr   )r   r   r   __name__)levelrF   rL   rE   r>   s      @r   make_methodz1_make_filtering_bound_logger.<locals>.make_method   sL     9;U#	C	6( TFU{r   c                |    |k  ry t         |   }|s | j                  ||fi |S  | j                  |||z  fi |S r   )r   rD   )r   rQ   r   r   r   rE   r>   s         r   logz)_make_filtering_bound_logger.<locals>.log   sS    9U#(4((u;;;$t$$T54<>2>>r   c                   K   |	k  ryt         |   |r|z  t        j                  t        j                         j
                        }t        j                         	 t        j                         j                  d fd       d{   }t        j                  |       |S 7 # t        j                  |       w xY ww)zq
        .. versionchanged:: 23.3.0
           Callsite parameters are now also collected under asyncio.
        Nc                 2     j                  fd      S )Nc                 ,     j                    fi S r   rC   rJ   s   r   r'   zN_make_filtering_bound_logger.<locals>.alog.<locals>.<lambda>.<locals>.<lambda>   s    1D11$DD r   r(   rK   s   r   r'   z<_make_filtering_bound_logger.<locals>.alog.<locals>.<lambda>   s    D r   )r   r   r-   r,   r.   r/   r0   r1   r2   r3   r4   r5   )
r   rQ   r   r   r   r6   r7   r*   rE   r>   s
   ` ` `  @@r   alogz*_make_filtering_bound_logger.<locals>.alog   s      9U#DLE(,,S]]_-C-CD	&&(	2"335EE F !&&y1 !&&y1s0   AC%.B1 B/B1 C/B1 1CC)rT   rX   rM   r#   r8   criticalfatal	acriticalafatalwarningwarnawarningawarninfomsgainfoamsgc                    |k\  S r   r   )r   rQ   r>   s     r   r'   z._make_filtering_bound_logger.<locals>.<lambda>   s    %92D r   is_enabled_forc                    S r   r   )r   r>   s    r   r'   z._make_filtering_bound_logger.<locals>.<lambda>   s    	 r   get_effective_levelBoundLoggerFilteringAtNotset)rQ   intrO   z-tuple[Callable[..., Any], Callable[..., Any]])r   r   rQ   rk   r   r;   r   r   r   r   rO   r   )r   itemsr#   r8   typer+   
capitalizer   )r>   rR   rT   rX   methslvlrE   s   `      r   _make_filtering_bound_loggerrq   ~   sQ   %%	6%N?&)25=@	4 47+EE"((* :	T)4S)9&dUQtf:&: #E+$E,:&E'NK(E(O)$E&M:&E'N=E%L'NE&M EE
#9E
 
 !2!29h!G!R!R!T UV	 r   rN   )
r   r   r   r;   r   r   r   r   rO   r   )r>   z	int | strrO   type[FilteringBoundLogger])r>   rk   rO   rr   )#__doc__
__future__r   r2   r0   r,   typingr   r   _baser   _log_levelsr   r	   r
   r   r   r   r   r   r   r   r   r   r#   r8   r?   rq   BoundLoggerFilteringAtNotsetBoundLoggerFilteringAtDebugBoundLoggerFilteringAtInfoBoundLoggerFilteringAtWarningBoundLoggerFilteringAtErrorBoundLoggerFilteringAtCriticalr=   r   r   r   <module>r~      s(   #   
   "	 	 	 . (*
*'**36*>A**
'*36>A2101010hhX  <FC :5A 9$?  <W E :5A !=h!G  ,	&*
$	&
( r   