o
    h                     @  s:  d Z ddlmZ ddl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 dZeZd	Zd
ZeZdZdZdZeeeeeeeedZdd e D Zd.ddZd/ddZd/d d!Zd0d#d$Zd0d%d&Zd1d*d+Zd1d,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 )2zL
Extracted log level data used by both stdlib and native log level filters.
    )annotationsN)AnyCallable   )BoundLoggerBase)	EventDictFilteringBoundLogger2   (         
   )critical	exceptionerrorwarnwarninginfodebugnotsetc                 C  s   i | ]\}}|d vr||qS ))r   r   r    ).0kvr   r   K/var/www/html/ai/venv/lib/python3.10/site-packages/structlog/_log_levels.py
<dictcomp>,   s
    r   loggerlogging.Loggermethod_namestr
event_dictr   returnc                 C  s   |dkrd}||d< |S )a  
    Add the log level to the event dict under the ``level`` key.

    Since that's just the log method name, this processor works with non-stdlib
    logging as well. Therefore it's importable both from `structlog.processors`
    as well as from `structlog.stdlib`.

    .. versionadded:: 15.0.0
    .. versionchanged:: 20.2.0
       Importable from `structlog.processors` (additionally to
       `structlog.stdlib`).
    r   r   levelr   )r   r   r    r   r   r   add_log_level3   s   r#   selfr   eventargskwc                 O  s   d S Nr   r$   r%   r&   r'   r   r   r   _nopK   s   r*   c                   s   d S r(   r   r)   r   r   r   _anopO   s   r+   r   c                 O  s$   | dd | j|g|R i |S )Nexc_infoT)
setdefaultr   r)   r   r   r   r   S   s   r   c                   sL    dddu rt d< t t d  fddI d H S )Nr,   Tc                     s     fddS )Nc                     s   j g R i S r(   )r   r   )r&   r%   r'   r$   r   r   <lambda>f       z.aexception.<locals>.<lambda>.<locals>.<lambda>runr   r&   ctxr%   r'   r$   r   r   r.   f   r/   zaexception.<locals>.<lambda>)getsysr,   contextvarscopy_contextasyncioget_running_looprun_in_executorr)   r   r2   r   
aexception[   s   
r;   	min_levelinttype[FilteringBoundLogger]c                 C  s   t |  S )a_  
    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>`.

    Arguments:

        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.

    .. 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.
    )_LEVEL_TO_FILTERING_LOGGERr<   r   r   r   make_filtering_bound_loggerj   s   )rA   c                   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 < 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``.
    r"   r=   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                   s@   |r| t   t d  fddI d H  d S )Nc                          fddS )Nc                        j  fi S r(   rC   r   r%   r'   rF   r$   r   r   r.          zd_make_filtering_bound_logger.<locals>.make_method.<locals>.ameth.<locals>.<lambda>.<locals>.<lambda>r0   r   r3   r%   r'   rF   r$   r   r   r.      s    zR_make_filtering_bound_logger.<locals>.make_method.<locals>.ameth.<locals>.<lambda>)r6   r7   r8   r9   r:   r)   rE   )r3   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+   _LEVEL_TO_NAME__name__)r"   rG   rM   r@   rE   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(   )rP   rD   )r$   r"   r%   r&   r'   rF   r@   r   r   log   s   z)_make_filtering_bound_logger.<locals>.logc                   sP   |k rd S t | |r| t  t d  fddI d H S )Nc                     rH   )Nc                     rI   r(   rC   r   rJ   r   r   r.      rK   zN_make_filtering_bound_logger.<locals>.alog.<locals>.<lambda>.<locals>.<lambda>r0   r   rL   r   r   r.      r/   z<_make_filtering_bound_logger.<locals>.alog.<locals>.<lambda>)rP   r6   r7   r8   r9   r:   )r$   r"   r%   r&   r'   r@   rL   r   alog   s   
z*_make_filtering_bound_logger.<locals>.alog)rS   rT   rN   r   r;   r   fatalaerrorafatalr   r   awarningawarnr   msgainfoamsgzBoundLoggerFilteringAt%sNotsetN)r"   r=   r!   rB   )r$   r   r"   r=   r%   r   r&   r   r'   r   r!   r   )rP   itemsr   r;   typer4   
capitalizer   )r<   rR   rS   rT   methslvlrF   r   r@   r   _make_filtering_bound_logger   s*   

rc   )r   r   r   r   r    r   r!   r   rO   )
r$   r   r%   r   r&   r   r'   r   r!   r   )r<   r=   r!   r>   )'__doc__
__future__r   r8   r6   loggingr5   typingr   r   _baser   r   r   CRITICALFATALERRORWARNINGWARNINFODEBUGNOTSET_NAME_TO_LEVELr^   rP   r#   r*   r+   r   r;   rA   rc   BoundLoggerFilteringAtNotsetBoundLoggerFilteringAtDebugBoundLoggerFilteringAtInfoBoundLoggerFilteringAtWarningBoundLoggerFilteringAtErrorBoundLoggerFilteringAtCriticalr?   r   r   r   r   <module>   sb   






,V