%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__/_stdlib.cpython-312.pyc

�

Ϫ�f��
���UdZddlZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
dd	lmZmZdd
lmZej&ej(ej*ej,ej.ej0ej2ej4ej6ej8iZee	efed<deee	ffd
�Z e �Z!ee�Gd�d��Z"Gd�d�Z#y)z3
Integration with Python standard library logging.
�N)�Mapping�Tuple)�implementer)�
NamedConstant)�currentframe�)�formatEvent)�ILogObserver�LogEvent)�LogLevel�toStdlibLogLevelMapping�returnc�|�i}tj�D]"\}}|||<||tj|�<�$|S)z�
    Reverse the above mapping, adding both the numerical keys used above and
    the corresponding string keys also used by python logging.
    @return: the reversed mapping
    )r
�items�
stdlibLogging�getLevelName)�mapping�logLevel�
pyLogLevels   �8/usr/lib/python3/dist-packages/twisted/logger/_stdlib.py�_reverseLogLevelMappingrsN���G� 7� =� =� ?�C���*�&��
��:B��
�*�*�:�6�7�C��N�c�d�eZdZdZdZdefdededdfd�Z	dd	ed
ede	eeedffd�Z
deddfd
�Zy)�STDLibLogObserverae
    Log observer that writes to the python standard library's C{logging}
    module.

    @note: Warning: specific logging configurations (example: network) can lead
        to this observer blocking.  Nothing is done here to prevent that, so be
        sure to not to configure the standard library logging module to block
        when used in conjunction with this module: code within Twisted, such as
        twisted.web, assumes that logging does not block.

    @cvar defaultStackDepth: This is the default number of frames that it takes
        to get from L{STDLibLogObserver} through the logging module, plus one;
        in other words, the number of frames if you were to call a
        L{STDLibLogObserver} directly.  This is useful to use as an offset for
        the C{stackDepth} parameter to C{__init__}, to add frames for other
        publishers.
    ��twisted�name�
stackDepthrNc�|�tj|�|_|j|j_||_y)z�
        @param name: logger identifier.
        @param stackDepth: The depth of the stack to investigate for caller
            metadata.
        N)r�	getLogger�logger�_findCaller�
findCallerr)�selfrrs   r�__init__zSTDLibLogObserver.__init__Es/��$�-�-�d�3���!%�!1�!1�����$��r�	stackInfo�
stackLevelc��t|j�}|j}d}|j|j|j
f|zS)a
        Based on the stack depth passed to this L{STDLibLogObserver}, identify
        the calling function.

        @param stackInfo: Whether or not to construct stack information.
            (Currently ignored.)
        @param stackLevel: The number of stack frames to skip when determining
            the caller (currently ignored; use stackDepth on the instance).

        @return: Depending on Python version, either a 3-tuple of (filename,
            lineno, name) or a 4-tuple of that plus stack information.
        �N)rr�f_code�co_filename�f_lineno�co_name)r$r&r'�f�co�extras      rr"zSTDLibLogObserver._findCallerQs>��
����)��
�X�X��������
�
�B�J�J�7�%�?�?r�eventc�T�|jdtj�}|jd�}|�d}n'|j|j|j�f}tj|tj�}|jj|t|�|��y)zB
        Format an event and bridge it to Python logging.
        �	log_level�log_failureN)�exc_info)�getr�info�type�value�getTracebackObjectr
r�INFOr!�log�StringifiableFromEvent)r$r1�level�failure�excInfo�stdlibLevels      r�__call__zSTDLibLogObserver.__call__es����	�	�+�x�}�}�5���)�)�M�*���?��G��|�|�W�]�]�G�4N�4N�4P�Q�G�-�1�1�%��9K�9K�L��������%;�E�%B�W��Ur)Fr)
�__name__�
__module__�__qualname__�__doc__�defaultStackDepth�str�intr%�boolrr"rrB�rrrr/s~���$��$�7H�
%��
%�14�
%�	
�
%�:;�@��@�36�@�	�s�C��d�"�	#�@�(V�h�V�4�Vrrc�8�eZdZdZdeddfd�Zdefd�Zdefd�Z	y)r=z�
    An object that implements C{__str__()} in order to defer the work of
    formatting until it's converted into a C{str}.
    r1rNc��||_y)z)
        @param event: An event.
        N)r1)r$r1s  rr%zStringifiableFromEvent.__init__ys����
rc�,�t|j�Sr))r	r1�r$s r�__str__zStringifiableFromEvent.__str__s���4�:�:�&�&rc�6�t|�jd�S)Nzutf-8)rH�encoderOs r�	__bytes__z StringifiableFromEvent.__bytes__�s���4�y����(�(r)
rCrDrErFrr%rHrP�bytesrSrKrrr=r=ss2���
�h��4��'��'�)�5�)rr=)$rF�loggingr�typingrr�zope.interfacer�
constantlyr�twisted.python.compatr�_formatr	�_interfacesr
r�_levelsr�debug�DEBUGr7r;�warn�WARNING�error�ERROR�critical�CRITICALr
rI�__annotations__r�fromStdlibLogLevelMappingrr=rKrr�<module>rgs���
� �!�&�$�.� �/��
�N�N�M�'�'��M�M�=�%�%��M�M�=�(�(��N�N�M�'�'����}�-�-�8�����!3�4��
���m�);�!<�
�4�5��
�\��@V�@V��@V�F)�)r

Zerion Mini Shell 1.0