ó
    öÞ jÄ  ã                  ó¸   • S r SSKJr  SSKrSSKJrJrJr  SSKJ	r	  SSK
Jr  SSKJrJrJrJr  \R                   S	:¼  a  SS
KJr  OSS
KJr   " S S5      rSS jrg)z"
Logger wrapper and helper class.
é    )ÚannotationsN)ÚIterableÚMappingÚSequence)ÚAny)Ú	DropEventé   )ÚBindableLoggerÚContextÚ	ProcessorÚWrappedLogger)é   é   )ÚSelfc                  óº   • \ rS rSr% SrS\S'          SS jrSS jrSS jrSS jr	SS	 jr
SS
 jrSS jrSS jr        SS jr S       SS jjrSrg)ÚBoundLoggerBaseé   z÷
Immutable context carrier.

Doesn't do any actual logging; examples for useful subclasses are:

- the generic `BoundLogger` that can wrap anything,
- `structlog.stdlib.BoundLogger`.
- `structlog.twisted.BoundLogger`,

See also `custom-wrappers`.
r   Ú_loggerc                ó(   • Xl         X l        X0l        g ©N)r   Ú_processorsÚ_context)ÚselfÚloggerÚ
processorsÚcontexts       ÚI/var/www/html/gaurav/venv/lib/python3.13/site-packages/structlog/_base.pyÚ__init__ÚBoundLoggerBase.__init__4   s   € ð ŒØ%ÔØ�ó    c                ón   • SU R                   R                   SU R                  < SU R                  < S3$ )NÚ<z	(context=z, processors=z)>)Ú	__class__Ú__name__r   r   )r   s    r   Ú__repr__ÚBoundLoggerBase.__repr__>   s6   € Ø�4—>‘>×*Ñ*Ð+¨9°T·]±]Ñ4EÀ]ÐSW×ScÑScÑRfÐfhÐiÐir    c                óV   •  U R                   UR                   :H  $ ! [         a     gf = f)NF)r   ÚAttributeError©r   Úothers     r   Ú__eq__ÚBoundLoggerBase.__eq__A   s,   € ð	Ø—=‘= E§N¡NÑ2Ð2øÜó 	Ùð	ús   ‚ ›
(§(c                ó.   • U R                  U5      (       + $ r   )r+   r)   s     r   Ú__ne__ÚBoundLoggerBase.__ne__G   s   € Ø—;‘;˜uÓ%Ô%Ð%r    c           	     óš   • U R                  U R                  U R                  U R                  R                   " U R                  40 UD65      $ )zC
Return a new logger with *new_values* added to the existing ones.
)r#   r   r   r   ©r   Ú
new_valuess     r   ÚbindÚBoundLoggerBase.bindJ   s@   € ð �~‰~Ø�L‰LØ×ÑØ�M‰M×#Ò# D§M¡MÑ@°ZÑ@ó
ð 	
r    c                óR   • U R                  5       nU H  nUR                  U	 M     U$ )zy
Return a new logger with *keys* removed from the context.

Raises:
    KeyError: If the key is not part of the context.
)r3   r   ©r   ÚkeysÚblÚkeys       r   ÚunbindÚBoundLoggerBase.unbindT   s,   € ð �Y‰Y‹[ˆÛˆCØ—‘˜CÒ ñ ð ˆ	r    c                óp   • U R                  5       nU H  nUR                  R                  US5        M!     U$ )z[
Like :meth:`unbind`, but best effort: missing keys are ignored.

.. versionadded:: 18.2.0
N)r3   r   Úpopr6   s       r   Ú
try_unbindÚBoundLoggerBase.try_unbinda   s2   € ð �Y‰Y‹[ˆÛˆCØ�K‰K�O‰O˜C Ö&ñ ð ˆ	r    c                óZ   • U R                   R                  5         U R                  " S0 UD6$ )zÆ
Clear context and binds *new_values* using `bind`.

Only necessary with dict implementations that keep global state like
those wrapped by `structlog.threadlocal.wrap_dict` when threads
are reused.
© )r   Úclearr3   r1   s     r   ÚnewÚBoundLoggerBase.newm   s&   € ð 	�‰×ÑÔà�yŠyÑ&˜:Ñ&Ð&r    c                óx  • U R                   R                  5       nUR                  " S0 UD6  Ub  X$S'   U R                   H  nU" U R                  X5      nM     [        U[        [        [        45      (       a  U40 4$ [        U[        5      (       a  U$ [        U[        5      (       a  SU4$ Sn[        U5      e)a7  
Combines creates an ``event_dict`` and runs the chain.

Call it to combine your *event* and *context* into an event_dict and
process using the processor chain.

Args:
    method_name:
        The name of the logger method.  Is passed into the processors.

    event:
        The event -- usually the first positional argument to a logger.

    event_kw:
        Additional event keywords.  For example if someone calls
        ``log.info("foo", bar=42)``, *event* would to be ``"foo"`` and
        *event_kw* ``{"bar": 42}``.

Raises:
    structlog.DropEvent: if log entry should be dropped.

    ValueError:
        if the final processor doesn't return a str, bytes, bytearray,
        tuple, or a dict.

Returns:
     `tuple` of ``(*args, **kw)``

.. note::
    Despite underscore available to custom wrapper classes.

    See also `custom-wrappers`.

.. versionchanged:: 14.0.0
    Allow final processor to return a `dict`.
.. versionchanged:: 20.2.0
    Allow final processor to return `bytes`.
.. versionchanged:: 21.2.0
    Allow final processor to return a `bytearray`.
ÚeventrA   zLast processor didn't return an appropriate value.  Valid return values are a dict, a tuple of (args, kwargs), bytes, or a str.)r   ÚcopyÚupdater   r   Ú
isinstanceÚstrÚbytesÚ	bytearrayÚtupleÚdictÚ
ValueError)r   Úmethod_namerF   Úevent_kwÚ
event_dictÚprocÚmsgs          r   Ú_process_eventÚBoundLoggerBase._process_event{   s¼   € ðZ Ÿ-™-×,Ñ,Ó.ˆ
Ø×ÒÑ%˜HÒ%àÑØ"'�wÑØ×$Ô$ˆDÙ˜dŸl™l¨KÓDŠJñ %ô �j¤3¬¬yÐ"9×:Ñ:Ø�= "Ð$Ð$ä�j¤%×(Ñ(ð Ðä�j¤$×'Ñ'Ø�z�>Ð!ðZð 	ô ˜‹oÐr    Nc                ó„   •  U R                  XU5      u  pE[        U R                  U5      " U0 UD6$ ! [         a     gf = f)a?  
Run processor chain on event & call *method_name* on wrapped logger.

DRY convenience method that runs :func:`_process_event`, takes care of
handling :exc:`structlog.DropEvent`, and finally calls *method_name* on
:attr:`_logger` with the result.

Args:
    method_name:
        The name of the method that's going to get called.  Technically
        it should be identical to the method the user called because it
        also get passed into processors.

    event:
        The event -- usually the first positional argument to a logger.

    event_kw:
        Additional event keywords.  For example if someone calls
        ``log.info("foo", bar=42)``, *event* would to be ``"foo"`` and
        *event_kw* ``{"bar": 42}``.

.. note::
    Despite underscore available to custom wrapper classes.

    See also `custom-wrappers`.
N)rU   Úgetattrr   r   )r   rP   rF   rQ   ÚargsÚkws         r   Ú_proxy_to_loggerÚ BoundLoggerBase._proxy_to_loggerÁ   sH   € ð:	Ø×*Ñ*¨;¸xÓH‰HˆDÜ˜4Ÿ<™<¨Ô5°tÐB¸rÑBÐBøÜó 	Ùð	ús   ‚/2 ²
?¾?)r   r   r   )r   r   r   zIterable[Processor]r   r   )ÚreturnrJ   )r*   Úobjectr]   Úbool)r2   r   r]   r   )r7   rJ   r]   r   )rP   rJ   rF   ú
str | NonerQ   zdict[str, Any]r]   z'tuple[Sequence[Any], Mapping[str, Any]]r   )rP   rJ   rF   r`   rQ   r   r]   r   )r$   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r   r%   r+   r.   r3   r:   r>   rC   rU   r[   Ú__static_attributes__rA   r    r   r   r      s³   ‡ ñ
ð Óðð àð ð (ð ð ô	 ôjôô&ô
ôô
ô
'ðDØðDØ'1ðDØ=KðDà	0ôDðN 59ð!Øð!Ø'1ð!ØFIð!à	÷!ð !r    r   c                ó   • U R                   $ )a   
Return *bound_logger*'s context.

The type of *bound_logger* and the type returned depend on your
configuration.

Args:
    bound_logger: The bound logger whose context you want.

Returns:
    The *actual* context from *bound_logger*. It is *not* copied first.

.. versionadded:: 20.2.0
)r   )Úbound_loggers    r   Úget_contextri   å   s   € ð  × Ñ Ð r    )rh   r
   r]   r   )rd   Ú
__future__r   ÚsysÚcollections.abcr   r   r   Útypingr   Ústructlog.exceptionsr   r
   r   r   r   Úversion_infor   Útyping_extensionsr   ri   rA   r    r   Ú<module>rq      sL   ðñõ #ã 
ç 7Ñ 7Ý å *ç EÓ Eð ×Ñ�wÓÞå&÷Fñ FõR!r    