o
    ADi                     @  s  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dZd"ddZd#ddZd#ddZd$ddZd%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"dS )&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)FilteringBoundLoggerselfr   eventstrargskwreturnc                 O  s   d S N r   r   r   r   r   r   J/var/www/Datamplify/venv/lib/python3.10/site-packages/structlog/_native.py_nop!   s   r   c                   s   d S r   r   r   r   r   r   _anop%   s   r   r   c                 O  s$   | dd | j|g|R i |S )Nexc_infoT)
setdefaulterrorr   r   r   r   	exception)   s   r    c              	     sz    dddu rt d< tt j}t zt	
 d fddI dH }W t| |S t| w )ze
    .. versionchanged:: 23.3.0
       Callsite parameters are now also collected under asyncio.
    r   TNc                     s     fddS )Nc                     s   j g R i S r   )r   r   )r   r   r   r   r   r   <lambda>B       z.aexception.<locals>.<lambda>.<locals>.<lambda>runr   r   ctxr   r   r   r   r   r!   B   r"   zaexception.<locals>.<lambda>)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   r%   r   
aexception1   s   	
r4   	min_level	int | strtype[FilteringBoundLogger]c                 C  s   t | trt|   } 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.
    )
isinstancer   r   lowerLEVEL_TO_FILTERING_LOGGERr5   r   r   r   make_filtering_bound_loggerJ   s   
.r<   intc                   s   d) fdd}d* fdd}d* fdd}||d}t  D ]\}}||\||< |d| < qt|d< t|d< |d |d< |d |d< |d |d< |d |d< |d |d< |d |d <  fd!d"|d#<  fd$d"|d%< td&t  d'  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``.
    levelr=   r   -tuple[Callable[..., Any], Callable[..., Any]]c                   sN   | k rt tfS t|   d fdd	}d fd
d} |_d  |_||fS )Nr   r   r   r   r   r   r   c                   s0   |s| j  |fi |S | j  || fi |S r   _proxy_to_loggerr   namer   r   meth   s   z?_make_filtering_bound_logger.<locals>.make_method.<locals>.methc              	     sj   |r| t t j}t  zt 	d fddI dH  W t 
| dS t 
| w )z}
            .. versionchanged:: 23.3.0
               Callsite parameters are now also collected under asyncio.
            Nc                          fddS )Nc                        j  fi S r   r@   r   r   r   rC   r   r   r   r!          zd_make_filtering_bound_logger.<locals>.make_method.<locals>.ameth.<locals>.<lambda>.<locals>.<lambda>r#   r   r&   r   r   rC   r   r   r   r!          zR_make_filtering_bound_logger.<locals>.make_method.<locals>.ameth.<locals>.<lambda>)r   r)   r(   r*   r+   r,   r-   r.   r/   r0   r1   )r   r   r   r   r2   rB   )r&   r   r   r   r   ameth   s   z@_make_filtering_bound_logger.<locals>.make_method.<locals>.ametha
r   r   r   r   r   r   r   r   r   r   )r   r   r   __name__)r>   rD   rK   r;   rB   r   make_method   s   z1_make_filtering_bound_logger.<locals>.make_methodr   r   r   r   r   r   c                   sD   | k rd S t | }|s| j||fi |S | j||| fi |S r   )r   rA   )r   r>   r   r   r   rC   r;   r   r   log   s   z)_make_filtering_bound_logger.<locals>.logc              	     s~   |k rdS t | |r| tt j}t  zt	 
d fddI dH }W t| |S t| w )zq
        .. versionchanged:: 23.3.0
           Callsite parameters are now also collected under asyncio.
        Nc                     rE   )Nc                     rF   r   r@   r   rG   r   r   r!      rH   zN_make_filtering_bound_logger.<locals>.alog.<locals>.<lambda>.<locals>.<lambda>r#   r   rI   r   r   r!      rJ   z<_make_filtering_bound_logger.<locals>.alog.<locals>.<lambda>)r   r   r)   r(   r*   r+   r,   r-   r.   r/   r0   r1   )r   r>   r   r   r   r2   r3   r;   rI   r   alog   s    
z*_make_filtering_bound_logger.<locals>.alog)rP   rQ   rL   r    r4   criticalfatal	acriticalafatalwarningwarnawarningawarninfomsgainfoamsgc                   s   | kS r   r   )r   r>   r;   r   r   r!      s    z._make_filtering_bound_logger.<locals>.<lambda>is_enabled_forc                   s    S r   r   )r   r;   r   r   r!      s    get_effective_levelBoundLoggerFilteringAtNotsetN)r>   r=   r   r?   )r   r   r>   r=   r   r   r   r   r   r   r   r   )r   itemsr    r4   typer'   
capitalizer   )r5   rO   rP   rQ   methslvlrC   r   r;   r   _make_filtering_bound_logger~   s*   '

rg   rM   )
r   r   r   r   r   r   r   r   r   r   )r5   r6   r   r7   )r5   r=   r   r7   )#__doc__
__future__r   r.   r,   r(   typingr   r   _baser   _log_levelsr   r   r	   r
   r   r   r   r   r   r   r   r   r    r4   r<   rg   BoundLoggerFilteringAtNotsetBoundLoggerFilteringAtDebugBoundLoggerFilteringAtInfoBoundLoggerFilteringAtWarningBoundLoggerFilteringAtErrorBoundLoggerFilteringAtCriticalr:   r   r   r   r   <module>   s:   (






4l