
    	hPn                       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ZddlZddl	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mZ ddlmZmZmZ ddlmZmZ ddlmZ dd	lmZ dd
lm Z m!Z!m"Z"m#Z# g dZ$ G d d          Z% G d d          Z&d;dZ' G d d          Z( G d d          Z) G d d          Z*d<d Z+ G d! d"          Z, e,            Z-	  e, e                      Z.	  G d# d$          Z/d=d+Z0 G d, d-          Z1d>d0Z2 G d1 d2          Z3 G d3 d4          Z4 G d5 d6ej5                  Z6 G d7 d8          Z7 G d9 d:          Z8dS )?z8
Processors useful regardless of the logging framework.
    )annotationsN)AnyCallableClassVar
Collection
NamedTupleSequenceTextIO   )_find_first_app_frame_and_name_format_exception_format_stack)_NAME_TO_LEVELadd_log_levelget_processname)ExceptionDictTransformer)	EventDictExceptionTransformerExcInfoWrappedLogger)r   r   CallsiteParameterCallsiteParameterAdderdict_tracebacksEventRenamerExceptionPrettyPrinterformat_exc_infoJSONRendererKeyValueRendererStackInfoRendererTimeStamperUnicodeDecoderUnicodeEncoderc                  ,    e Zd ZdZ	 	 	 	 dddZddZdS )r   a  
    Render ``event_dict`` as a list of ``Key=repr(Value)`` pairs.

    Arguments:

        sort_keys: Whether to sort keys when formatting.

        key_order:
            List of keys that should be rendered in this exact order.  Missing
            keys will be rendered as ``None``, extra keys depending on
            *sort_keys* and the dict class.

        drop_missing:
            When ``True``, extra keys in *key_order* will be dropped rather
            than rendered as ``None``.

        repr_native_str:
            When ``True``, :func:`repr()` is also applied to native strings.

    .. versionadded:: 0.2.0 *key_order*
    .. versionadded:: 16.1.0 *drop_missing*
    .. versionadded:: 17.1.0 *repr_native_str*
    FNT	sort_keysbool	key_orderSequence[str] | Nonedrop_missingrepr_native_strc                l    t          |||          | _        |du rt          | _        d S dd}|| _        d S )NTinstr   returnstrc                N    t          | t                    r| S t          |           S N)
isinstancer.   repr)r,   s    a/var/www/html/web-builder-api.evdpl.com/venv/lib/python3.11/site-packages/structlog/processors.py_reprz(KeyValueRenderer.__init__.<locals>._reprd   s%    dC((  KDzz!    )r,   r   r-   r.   )_items_sorter_ordered_itemsr2   r4   )selfr%   r'   r)   r*   r4   s         r3   __init__zKeyValueRenderer.__init__W   sO     ,Iy,OOd""DJJJ" " " " DJJJr5   _r   __r.   
event_dictr   r-   c                l     d                      fd                     |          D                       S )N c              3  T   K   | ]"\  }}|d z                        |          z   V  #dS )=N)r4   ).0kvr8   s      r3   	<genexpr>z,KeyValueRenderer.__call__.<locals>.<genexpr>o   sK       
 
(,1AGdjjmm#
 
 
 
 
 
r5   )joinr7   )r8   r:   r;   r<   s   `   r3   __call__zKeyValueRenderer.__call__l   sO     xx 
 
 
 
040C0CJ0O0O
 
 
 
 
 	
r5   FNFT)r%   r&   r'   r(   r)   r&   r*   r&   r:   r   r;   r.   r<   r   r-   r.   __name__
__module____qualname____doc__r9   rF    r5   r3   r   r   >   sY         4  *." $    *
 
 
 
 
 
r5   r   c                  ,    e Zd ZdZ	 	 	 	 dddZddZdS )LogfmtRendereraP  
    Render ``event_dict`` using the logfmt_ format.

    .. _logfmt: https://brandur.org/logfmt

    Arguments:

        sort_keys: Whether to sort keys when formatting.

        key_order:
            List of keys that should be rendered in this exact order. Missing
            keys are rendered with empty values, extra keys depending on
            *sort_keys* and the dict class.

        drop_missing:
            When ``True``, extra keys in *key_order* will be dropped rather
            than rendered with empty values.

        bool_as_flag:
            When ``True``, render ``{"flag": True}`` as ``flag``, instead of
            ``flag=true``. ``{"flag": False}`` is always rendered as
            ``flag=false``.

    Raises:

        ValueError: If a key contains non printable or space characters.

    .. versionadded:: 21.5.0
    FNTr%   r&   r'   r(   r)   bool_as_flagc                @    t          |||          | _        || _        d S r0   )r6   r7   rQ   )r8   r%   r'   r)   rQ   s        r3   r9   zLogfmtRenderer.__init__   s&     ,Iy,OO(r5   r:   r   r;   r.   r<   r   r-   c                   g }|                      |          D ]\  }}t          d |D                       rd| d}t          |          ||                    | d           Nt	          |t
                    r&| j        r|r|                    |            |rdnd}|                     dd          }d|v sd|v rd| d}|                    | d|            d                    |          S )	Nc              3  "   K   | ]
}|d k    V  dS )r>   NrN   )rA   cs     r3   rD   z*LogfmtRenderer.__call__.<locals>.<genexpr>   s&      ))18))))))r5   zInvalid key: ""r@   truefalsez\"r>   )	r7   any
ValueErrorappendr1   r&   rQ   replacerE   )r8   r:   r;   r<   elementskeyvaluemsgs           r3   rF   zLogfmtRenderer.__call__   s8    !--j99 	. 	.JC))S))))) &-s--- oo%}3			***%&& 5$  OOsH---"'4WJ&&sE22Ee||se||$EOOs,,U,,----xx!!!r5   rG   )r%   r&   r'   r(   r)   r&   rQ   r&   rH   rI   rN   r5   r3   rP   rP   t   sZ         @  *."!) ) ) ) )" " " " " "r5   rP   r%   r&   r'   r(   r)   r-   /Callable[[EventDict], list[tuple[str, object]]]c                l    r
| rd	fd}n%rd	fd}n| rd	d}nt          j        d          }|S )
z
    Return a function to sort items from an ``event_dict``.

    See `KeyValueRenderer` for an explanation of the parameters.
    r<   r   r-   list[tuple[str, Any]]c                    g }D ]3}|                      |d           }|s|                    ||f           4|t          |                                           z  }|S r0   )popr[   sorteditemsr<   rg   r^   r_   r)   r'   s       r3   ordered_itemsz$_items_sorter.<locals>.ordered_items   so    E  / /"sD11$L$LL#u...VJ,,..///ELr5   c                    g }D ]3}|                      |d           }|s|                    ||f           4||                                 z  }|S r0   )re   r[   rg   rh   s       r3   ri   z$_items_sorter.<locals>.ordered_items   sg    E  / /"sD11$L$LL#u...Z%%'''ELr5   c                D    t          |                                           S r0   )rf   rg   )r<   s    r3   ri   z$_items_sorter.<locals>.ordered_items   s    ***,,---r5   rg   )r<   r   r-   rc   )operatormethodcaller)r%   r'   r)   ri   s    `` r3   r6   r6      s      "
Y "
		 		 		 		 		 		 		 		 
 
		 		 		 		 		 		 		 		 
 
	. 	. 	. 	. 	. !-
 
 r5   c                  <    e Zd ZU dZded<   ded<   	 dddZddZdS )r#   aY  
    Encode unicode values in ``event_dict``.

    Arguments:

        encoding: Encoding to encode to (default: ``"utf-8"``).

        errors:
            How to cope with encoding errors (default ``"backslashreplace"``).

    Just put it in the processor chain before the renderer.

    .. note:: Not very useful in a Python 3-only world.
    r.   	_encoding_errorsutf-8backslashreplaceencodingerrorsr-   Nonec                "    || _         || _        d S r0   ro   rp   r8   rs   rt   s      r3   r9   zUnicodeEncoder.__init__        "r5   loggerr   namer<   r   c                    |                                 D ]=\  }}t          |t                    r#|                    | j        | j                  ||<   >|S r0   )rg   r1   r.   encodero   rp   r8   rz   r{   r<   r^   r_   s         r3   rF   zUnicodeEncoder.__call__  sZ     %**,, 	M 	MJC%%% M"',,t~t|"L"L
3r5   N)rq   rr   rs   r.   rt   r.   r-   ru   rz   r   r{   r.   r<   r   r-   r   rJ   rK   rL   rM   __annotations__r9   rF   rN   r5   r3   r#   r#      sg           NNNLLL 6H         r5   r#   c                  <    e Zd ZU dZded<   ded<   	 dddZddZdS )r"   au  
    Decode byte string values in ``event_dict``.

    Arguments:

        encoding: Encoding to decode from (default: ``"utf-8"``).

        errors: How to cope with encoding errors (default: ``"replace"``).

    Useful to prevent ``b"abc"`` being rendered as as ``'b"abc"'``.

    Just put it in the processor chain before the renderer.

    .. versionadded:: 15.4.0
    r.   ro   rp   rq   r\   rs   rt   r-   ru   c                "    || _         || _        d S r0   rw   rx   s      r3   r9   zUnicodeDecoder.__init__#  ry   r5   rz   r   r{   r<   r   c                    |                                 D ]=\  }}t          |t                    r#|                    | j        | j                  ||<   >|S r0   )rg   r1   bytesdecodero   rp   r~   s         r3   rF   zUnicodeDecoder.__call__)  sZ     %**,, 	M 	MJC%'' M"',,t~t|"L"L
3r5   N)rq   r\   r   r   r   rN   r5   r3   r"   r"     sf            NNNLLL 6?         r5   r"   c                  0    e Zd ZdZej        fddZddZdS )r   aV  
    Render the ``event_dict`` using ``serializer(event_dict, **dumps_kw)``.

    Arguments:

        dumps_kw:
            Are passed unmodified to *serializer*.  If *default* is passed, it
            will disable support for ``__structlog__``-based serialization.

        serializer:
            A :func:`json.dumps`-compatible callable that will be used to
            format the string.  This can be used to use alternative JSON
            encoders like `orjson <https://pypi.org/project/orjson/>`__ or
            `RapidJSON <https://pypi.org/project/python-rapidjson/>`_
            (default: :func:`json.dumps`).

    .. versionadded:: 0.2.0 Support for ``__structlog__`` serialization method.
    .. versionadded:: 15.4.0 *serializer* parameter.
    .. versionadded:: 18.2.0
       Serializer's *default* parameter can be overwritten now.
    
serializerCallable[..., str | bytes]dumps_kwr   r-   ru   c                X    |                     dt                     || _        || _        d S )Ndefault)
setdefault_json_fallback_handler	_dumps_kw_dumps)r8   r   r   s      r3   r9   zJSONRenderer.__init__J  s-    
 	I'=>>>! r5   rz   r   r{   r.   r<   r   str | bytesc                (     | j         |fi | j        S )zT
        The return type of this depends on the return type of self._dumps.
        )r   r   r8   rz   r{   r<   s       r3   rF   zJSONRenderer.__call__S  s      t{:88888r5   N)r   r   r   r   r-   ru   )rz   r   r{   r.   r<   r   r-   r   )rJ   rK   rL   rM   jsondumpsr9   rF   rN   r5   r3   r   r   3  sR         0 26! ! ! ! !9 9 9 9 9 9r5   r   objr   c                    ddl m} t          | |          r| j        S 	 |                                 S # t
          $ r t          |           cY S w xY w)zQ
    Serialize custom datatypes and pass the rest to __structlog__ & repr().
    r   )_ThreadLocalDictWrapper)structlog.threadlocalr   r1   _dict__structlog__AttributeErrorr2   )r   r   s     r3   r   r   \  su    
 >=====#.// y  """   Cyys   3 AAc                  &    e Zd ZdZefddZddZdS )ExceptionRenderera  
    Replace an ``exc_info`` field with an ``exception`` field which is rendered
    by *exception_formatter*.

    The contents of the ``exception`` field depends on the return value of the
    *exception_formatter* that is passed:

    - The default produces a formatted string via Python's built-in traceback
      formatting (this is :obj:`.format_exc_info`).
    - If you pass a :class:`~structlog.tracebacks.ExceptionDictTransformer`, it
      becomes a list of stack dicts that can be serialized to JSON.

    If *event_dict* contains the key ``exc_info``, there are three possible
    behaviors:

    1. If the value is a tuple, render it into the key ``exception``.
    2. If the value is an Exception render it into the key ``exception``.
    3. If the value true but no tuple, obtain exc_info ourselves and render
       that.

    If there is no ``exc_info`` key, the *event_dict* is not touched. This
    behavior is analog to the one of the stdlib's logging.

    Arguments:

        exception_formatter:
            A callable that is used to format the exception from the
            ``exc_info`` field into the ``exception`` field.

    .. seealso::
        :doc:`exceptions` for a broader explanation of *structlog*'s exception
        features.

    .. versionadded:: 22.1.0
    exception_formatterr   r-   ru   c                    || _         d S r0   )format_exception)r8   r   s     r3   r9   zExceptionRenderer.__init__  s     !4r5   rz   r   r{   r.   r<   r   c                    |                     dd           }|r%|                     t          |                    |d<   |S )Nexc_info	exception)re   r   _figure_out_exc_info)r8   rz   r{   r<   r   s        r3   rF   zExceptionRenderer.__call__  sL     >>*d33 	&*&;&;$X..' 'J{# r5   N)r   r   r-   ru   r   rJ   rK   rL   rM   r   r9   rF   rN   r5   r3   r   r   l  sR        " "L 5F4 4 4 4 4	 	 	 	 	 	r5   r   c                  >    e Zd ZdZdZ	 	 	 dddZddZddZddZdS )r!   a  
    Add a timestamp to ``event_dict``.

    Arguments:

        fmt:
            strftime format string, or ``"iso"`` for `ISO 8601
            <https://en.wikipedia.org/wiki/ISO_8601>`_, or `None` for a `UNIX
            timestamp <https://en.wikipedia.org/wiki/Unix_time>`_.

        utc: Whether timestamp should be in UTC or local time.

        key: Target key in *event_dict* for added timestamps.

    .. versionchanged:: 19.2.0 Can be pickled now.
    )_stamperfmtutcr^   NT	timestampr   
str | Noner   r&   r^   r.   r-   ru   c                ^    |||c| _         | _        | _        t          |||          | _        d S r0   r   r   r^   _make_stamperr   r8   r   r   r^   s       r3   r9   zTimeStamper.__init__  s1     (+C$$(DH%c344r5   rz   r   r{   r<   r   c                ,    |                      |          S r0   )r   r   s       r3   rF   zTimeStamper.__call__  s     }}Z(((r5   dict[str, Any]c                ,    | j         | j        | j        dS Nr   r   r^   r   )r8   s    r3   __getstate__zTimeStamper.__getstate__  s    xBBBr5   statec                v    |d         | _         |d         | _        |d         | _        t          di || _        d S )Nr   r   r^   rN   r   )r8   r   s     r3   __setstate__zTimeStamper.__setstate__  s<    <<<%....r5   NTr   )r   r   r   r&   r^   r.   r-   ru   r   )r-   r   )r   r   r-   ru   )	rJ   rK   rL   rM   	__slots__r9   rF   r   r   rN   r5   r3   r!   r!     s         " 2I 	5 5 5 5 5) ) ) )
C C C C/ / / / / /r5   r!   r   r   r   r^   r.    Callable[[EventDict], EventDict]c                      |sd}t          |          |rddndd dfd	}|S                                  d
k    rdfd}dfd}|r|S |S d fd}|S )z$
    Create a stamper function.
    NzUNIX timestamps are always UTC.r-   datetime.datetimec                 `    t           j                             t           j        j                  S )N)tz)datetimenowtimezoner   rN   r5   r3   r   z_make_stamper.<locals>.now  s"    $((H,=,A(BBBr5   c                 >    t           j                                         S r0   )r   r   rN   r5   r3   r   z_make_stamper.<locals>.now  s    $((***r5   r<   r   c                4    t          j                     | <   | S r0   )time)r<   r^   s    r3   stamper_unixz#_make_stamper.<locals>.stamper_unix  s    "ikkJsOr5   ISOc                F                                                  | <   | S r0   )	isoformatr<   r^   r   s    r3   stamper_iso_localz(_make_stamper.<locals>.stamper_iso_local  s"    !ceeoo//JsOr5   c                n                                                                      dd          | <   | S )Nz+00:00Z)r   r\   r   s    r3   stamper_iso_utcz&_make_stamper.<locals>.stamper_iso_utc  s2    !ceeoo//77#FFJsOr5   c                H                                                | <   | S r0   )strftime)r<   r   r^   r   s    r3   stamper_fmtz"_make_stamper.<locals>.stamper_fmt'  s$    #%%..--
3r5   )r-   r   )r<   r   r-   r   )rZ   upper)	r   r   r^   r`   r   r   r   r   r   s	   ` `     @r3   r   r     s)    {3{/oo  	+	C 	C 	C 	C 	C
	+ 	+ 	+ 	+ {	 	 	 	 	 	
 
yy{{e	 	 	 	 	 	 		 	 	 	 	 	 	  	#""         
 r5   c                  .    e Zd ZdZdZ	 	 	 dddZddZdS )MaybeTimeStampera  
    A timestamper that only adds a timestamp if there is none.

    This allows you to overwrite the ``timestamp`` key in the event dict for
    example when the event is coming from another system.

    It takes the same arguments as `TimeStamper`.

    .. versionadded:: 23.2.0
    stamperNTr   r   r   r   r&   r^   r.   c                4    t          |||          | _        d S r   )r!   r   r   s       r3   r9   zMaybeTimeStamper.__init__=  s     #s===r5   rz   r   r{   r<   r   r-   c                <    d|vr|                      |||          S |S )Nr   r   r   s       r3   rF   zMaybeTimeStamper.__call__E  s+     j((<<j999r5   r   )r   r   r   r&   r^   r.   r   rJ   rK   rL   rM   r   r9   rF   rN   r5   r3   r   r   /  s]        	 	 I 	> > > > >     r5   r   rC   r   c                    t          | t                    r| j        | | j        fS t          | t                    r| S | rt          j                    S | S )z
    Depending on the Python version will try to do the smartest thing possible
    to transform *v* into an ``exc_info`` tuple.
    )r1   BaseException	__class____traceback__tuplesysr   )rC   s    r3   r   r   N  sW    
 !]## 1Q00!U  |~~Hr5   c                  (    e Zd ZdZdefdd	ZddZdS )r   a  
    Pretty print exceptions and remove them from the ``event_dict``.

    Arguments:

        file: Target file for output (default: ``sys.stdout``).

    This processor is mostly for development and testing so you can read
    exceptions properly formatted.

    It behaves like `format_exc_info` except it removes the exception data from
    the event dictionary after printing it.

    It's tolerant to having `format_exc_info` in front of itself in the
    processor chain but doesn't require it.  In other words, it handles both
    ``exception`` as well as ``exc_info`` keys.

    .. versionadded:: 0.4.0

    .. versionchanged:: 16.0.0
       Added support for passing exceptions as ``exc_info`` on Python 3.
    NfileTextIO | Noner   r   r-   ru   c                >    |	|| _         d S t          j        | _         d S r0   )_filer   stdout)r8   r   r   s      r3   r9   zExceptionPrettyPrinter.__init__w  s"    
 DJJJDJJJr5   rz   r   r{   r.   r<   r   c                    |                     dd           }|4t          |                     dd                     }|rt          |          }|rt          || j                   |S )Nr   r   )r   )re   r   r   printr   )r8   rz   r{   r<   excr   s         r3   rF   zExceptionPrettyPrinter.__call__  so     nn[$//;+JNN:t,L,LMMH 2'11 	(#DJ''''r5   )r   r   r   r   r-   ru   r   r   rN   r5   r3   r   r   _  sS         2 #4E$ $ $ $ $     r5   r   c                  (    e Zd ZdZdZdddZddZdS )r    a  
    Add stack information with key ``stack`` if ``stack_info`` is `True`.

    Useful when you want to attach a stack dump to a log entry without
    involving an exception and works analogously to the *stack_info* argument
    of the Python standard library logging.

    Arguments:

        additional_ignores:
            By default, stack frames coming from *structlog* are ignored. With
            this argument you can add additional names that are ignored, before
            the stack starts being rendered. They are matched using
            ``startswith()``, so they don't have to match exactly. The names
            are used to find the first relevant name, therefore once a frame is
            found that doesn't start with *structlog* or one of
            *additional_ignores*, **no filtering** is applied to subsequent
            frames.

    .. versionadded:: 0.4.0
    .. versionadded:: 22.1.0  *additional_ignores*
    _additional_ignoresNadditional_ignoreslist[str] | Noner-   ru   c                    || _         d S r0   r   )r8   r   s     r3   r9   zStackInfoRenderer.__init__  s    #5   r5   rz   r   r{   r.   r<   r   c                    |                     dd           r*t          t          | j                  d                   |d<   |S )N
stack_infor   stack)re   r   r   r   r   s       r3   rF   zStackInfoRenderer.__call__  sI     >>,-- 	"/.t/GHHK# #Jw r5   r0   )r   r   r-   ru   r   r   rN   r5   r3   r    r      sR         . )I6 6 6 6 6     r5   r    c                  6    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdS )r   a5  
    Callsite parameters that can be added to an event dictionary with the
    `structlog.processors.CallsiteParameterAdder` processor class.

    The string values of the members of this enum will be used as the keys for
    the callsite parameters in the event dictionary.

    .. versionadded:: 21.5.0
    pathnamefilenamemodule	func_namelinenothreadthread_nameprocessprocess_nameN)rJ   rK   rL   rM   PATHNAMEFILENAMEMODULE	FUNC_NAMELINENOTHREADTHREAD_NAMEPROCESSPROCESS_NAMErN   r5   r3   r   r     sK          H H FIFFKG!LLLr5   r   c                     e Zd ZU dZej        d ej        d ej        d ej        d ej	        d ej
        d ej        d ej        d	 ej        d
 i	Zded<   ej        dej        dej        dej        dej	        dej
        dej        dej        dej        di	Zded<    ee          Zded<    G d de          ZdZedfd,d$Zd-d+ZdS ).r   a  
    Adds parameters of the callsite that an event dictionary originated from to
    the event dictionary. This processor can be used to enrich events
    dictionaries with information such as the function name, line number and
    filename that an event dictionary originated from.

    .. warning::
        This processor cannot detect the correct callsite for invocation of
        async functions.

    If the event dictionary has an embedded `logging.LogRecord` object and did
    not originate from *structlog* then the callsite information will be
    determined from the `logging.LogRecord` object. For event dictionaries
    without an embedded `logging.LogRecord` object the callsite will be
    determined from the stack trace, ignoring all intra-structlog calls, calls
    from the `logging` module, and stack frames from modules with names that
    start with values in ``additional_ignores``, if it is specified.

    The keys used for callsite parameters in the event dictionary are the
    string values of `CallsiteParameter` enum members.

    Arguments:

        parameters:
            A collection of `CallsiteParameter` values that should be added to
            the event dictionary.

        additional_ignores:
            Additional names with which a stack frame's module name must not
            start for it to be considered when determening the callsite.

    .. note::

        When used with `structlog.stdlib.ProcessorFormatter` the most efficient
        configuration is to either use this processor in ``foreign_pre_chain``
        of `structlog.stdlib.ProcessorFormatter` and in ``processors`` of
        `structlog.configure`, or to use it in ``processors`` of
        `structlog.stdlib.ProcessorFormatter` without using it in
        ``processors`` of `structlog.configure` and ``foreign_pre_chain`` of
        `structlog.stdlib.ProcessorFormatter`.

    .. versionadded:: 21.5.0
    c                    |j         S r0   )r   r   
frame_infos     r3   <lambda>zCallsiteParameterAdder.<lambda>  	    z': r5   c                J    t           j                            |j                  S r0   )ospathbasenamer   r	  s     r3   r  zCallsiteParameterAdder.<lambda>  s    rw'7'7
8K'L'L r5   c                    t           j                            t           j                            |j                            d         S )Nr   )r  r  splitextr  r   r	  s     r3   r  zCallsiteParameterAdder.<lambda>  s6    rw'7'7  !455( (( r5   c                    |j         S r0   )functionr	  s     r3   r  zCallsiteParameterAdder.<lambda>  r  r5   c                    |j         S r0   )r   r	  s     r3   r  zCallsiteParameterAdder.<lambda>  s	    z'8 r5   c                (    t          j                    S r0   )	threading	get_identr	  s     r3   r  zCallsiteParameterAdder.<lambda>  s    y':'<'< r5   c                2    t          j                    j        S r0   )r  current_threadr{   r	  s     r3   r  zCallsiteParameterAdder.<lambda>  s    y'?'A'A'F r5   c                (    t          j                    S r0   )r  getpidr	  s     r3   r  zCallsiteParameterAdder.<lambda>!  s    ry{{ r5   c                    t                      S r0   r   r	  s     r3   r  zCallsiteParameterAdder.<lambda>#  s    '8'8 r5   zJClassVar[dict[CallsiteParameter, Callable[[str, inspect.Traceback], Any]]]	_handlersr   r   r   funcNamer   r   
threadNamer   processNamez&ClassVar[dict[CallsiteParameter, str]]_record_attribute_mapz ClassVar[set[CallsiteParameter]]_all_parametersc                  $    e Zd ZU ded<   ded<   dS )%CallsiteParameterAdder._RecordMappingr.   event_dict_keyrecord_attributeN)rJ   rK   rL   r   rN   r5   r3   _RecordMappingr%  4  s*         r5   r(  )_active_handlersr   _record_mappingsN
parametersCollection[CallsiteParameter]r   r   r-   ru   c                   |g }dg|| _         g | _        g | _        |D ]g}| j                            || j        |         f           | j                            |                     |j        | j        |                              hd S )Nlogging)r   r)  r*  r[   r  r(  r_   r"  )r8   r+  r   	parameters       r3   r9   zCallsiteParameterAdder.__init__:  s    
 %!# %.#C0B#C   	 NP# 		 		I!((DN956   !((##O.y9    			 		r5   rz   logging.Loggerr{   r.   r<   r   c                F   |                     d          }|                     d          }|'|s%| j        D ]}|j        |j                 ||j        <   nMt          | j                  \  }}t          j        |          }	| j	        D ]\  }
} |||	          ||
j
        <   |S )N_record_from_structlog)r   )getr*  __dict__r'  r&  r   r   inspectgetframeinfor)  r_   )r8   rz   r{   r<   recordfrom_structlogmappingframer   r
  r/  handlers               r3   rF   zCallsiteParameterAdder.__call__T  s     ,6>>)+D+D&0nn5F&G&G n0  5;_,6
7122
 ;#'#;  ME6 !-e44J&*&; J J"	7.5gfj.I.I
9?++r5   )r+  r,  r   r   r-   ru   rz   r0  r{   r.   r<   r   r-   r   )rJ   rK   rL   rM   r   r   r   r   r  r  r  r  r  r  r  r   r"  setr#  r   r(  r   r9   rF   rN   r5   r3   r   r     s        * *^ 	"::"LL   	#:: 88 <<%FF!$J$J&885	     @ 	"J"J (#Z ( (%|!9&
E 
 
 
 
 9<<M8N8NONNNN        PI 5D/3    4     r5   r   c                  $    e Zd ZdZdddZddZdS )r   a  
    Rename the ``event`` key in event dicts.

    This is useful if you want to use consistent log message keys across
    platforms and/or use the ``event`` key for something custom.

    .. warning::

       It's recommended to put this processor right before the renderer, since
       some processors may rely on the presence and meaning of the ``event``
       key.

    Arguments:

        to: Rename ``event_dict["event"]`` to ``event_dict[to]``

        replace_by:
            Rename ``event_dict[replace_by]`` to ``event_dict["event"]``.
            *replace_by* missing from ``event_dict`` is handled gracefully.

    .. versionadded:: 22.1.0

    See also the :ref:`rename-event` recipe.
    Ntor.   
replace_byr   c                "    || _         || _        d S r0   )r@  rA  )r8   r@  rA  s      r3   r9   zEventRenamer.__init__  s    $r5   rz   r0  r{   r<   r   r-   c                    |                     d          }||| j        <   | j        "|                     | j        d           }|||d<   |S )Nevent)re   r@  rA  )r8   rz   r{   r<   rD  rA  s         r3   rF   zEventRenamer.__call__  sT     w''#
47?&#>>J%&0
7#r5   r0   )r@  r.   rA  r   r=  rI   rN   r5   r3   r   r   j  sK         2% % % % %     r5   r   )r%   r&   r'   r(   r)   r&   r-   ra   )r   r   r-   r   )r   r   r   r&   r^   r.   r-   r   )rC   r   r-   r   )9rM   
__future__r   r   enumr6  r   r.  rl   r  r   r  r   typingr   r   r   r   r   r	   r
   _framesr   r   r   _log_levelsr   r   _utilsr   
tracebacksr   r   r   r   r   __all__r   rP   r6   r#   r"   r   r   r   r   r   r!   r   r   r   r   r    Enumr   r   r   rN   r5   r3   <module>rN     s8    # " " " " "       				 



                               
 7 6 6 6 6 6 6 6 # # # # # # 0 0 0 0 0 0 K K K K K K K K K K K K  $3
 3
 3
 3
 3
 3
 3
 3
lC" C" C" C" C" C" C" C"L/ / / /d               F! ! ! ! ! ! ! !H&9 &9 &9 &9 &9 &9 &9 &9R    4 4 4 4 4 4 4 4n $#%%( $#$<$<$>$>??"+/ +/ +/ +/ +/ +/ +/ +/\4 4 4 4n       >   ". . . . . . . .b% % % % % % % %P" " " " "	 " " "DM M M M M M M M`) ) ) ) ) ) ) ) ) )r5   