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

�

Ϫ�f�&���dZddlmZddlmZmZmZddlmZddlm	Z	ddl
mZmZddl
mZmZGd	�d
�Ze�Zd�Zy)
z
Logger class.
�)�time)�Any�Optional�cast)�currentframe)�Failure�)�ILogObserver�LogTrace)�InvalidLogLevelError�LogLevelc�j�eZdZdZedefd��Z			ddeedeededddfd	�Z	dd
edee
ddfd�Zdefd
�Z	dde
deededdfd�Zde
jfdedeede
deddf
d�Zddeededdfd�Zddeededdfd�Zddeededdfd�Zddeededdfd�Zddeededdfd�Zy)�Loggera~
    A L{Logger} emits log messages to an observer.  You should instantiate it
    as a class or module attribute, as documented in L{this module's
    documentation <twisted.logger>}.

    @ivar namespace: the namespace for this logger
    @ivar source: The object which is emitting events via this logger
    @ivar observer: The observer that this logger will send events to.
    �returnc�n�	tttd�jd�S#t$rYywxYw)z�
        Derive a namespace from the module containing the caller's caller.

        @return: the fully qualified python name of a module.
        ��__name__z	<unknown>)r�strr�	f_globals�KeyError���8/usr/lib/python3/dist-packages/twisted/logger/_logger.py�_namespaceFromCallingContextz#Logger._namespaceFromCallingContexts5��	���\�!�_�6�6�z�B�C�C���	��	�s�%(�	4�4N�	namespace�source�observerr
c�r�|�|j�}||_||_|�ddlm}||_y||_y)a3
        @param namespace: The namespace for this logger.  Uses a dotted
            notation, as used by python modules.  If not L{None}, then the name
            of the module of the caller is used.
        @param source: The object which is emitting events via this
            logger; this is automatically set on instances of a class
            if this L{Logger} is an attribute of that class.
        @param observer: The observer that this logger will send events to.
            If L{None}, use the L{global log publisher <globalLogPublisher>}.
        Nr	)�globalLogPublisher)rrr�_globalrr)�selfrrrrs     r�__init__zLogger.__init__)s=�� ���9�9�;�I�"��������3�*<�D�M�$�D�Mr�instance�ownerc��|�J�|�|}n|}|jdj|j|jg�||j��S)a�
        When used as a descriptor, i.e.::

            # File: athing.py
            class Something:
                log = Logger()
                def hello(self):
                    self.log.info("Hello")

        a L{Logger}'s namespace will be set to the name of the class it is
        declared on.  In the above example, the namespace would be
        C{athing.Something}.

        Additionally, its source will be set to the actual object referring to
        the L{Logger}.  In the above example, C{Something.log.source} would be
        C{Something}, and C{Something().log.source} would be an instance of
        C{Something}.
        �.)r)�	__class__�join�
__module__rr)r!r#r$rs    r�__get__zLogger.__get__Fs[��&� � � ����F��F��~�~��H�H�e�&�&����7�8���]�]��
�	
rc�P�d|jj�d|j�d�S)N�<� �>)r'rr)r!s r�__repr__zLogger.__repr__fs'���4�>�>�*�*�+�1�T�^�^�,>�a�@�@r�level�format�kwargsc	�p�|tj�vr(|jdtt	|��||��y|}|j|||j|j|t���d|vr.tt|d�j||jf�|j|�y)a
        Emit a log event to all log observers at the given level.

        @param level: a L{LogLevel}
        @param format: a message format using new-style (PEP 3101)
            formatting.  The logging event (which is a L{dict}) is
            used to render this format string.
        @param kwargs: additional key/value pairs to include in the event.
            Note that values which are later mutated may result in
            non-deterministic behavior from observers that schedule work for
            later execution.
        z:Got invalid log level {invalidLevel!r} in {logger}.emit().)�invalidLevel�loggerN)�
log_logger�	log_level�
log_namespace�
log_source�
log_format�log_time�	log_trace)
r
�
iterconstants�failurerr�updaterrrrr�appendr)r!r0r1r2�events     r�emitzLogger.emitis�����.�.�0�0��L�L�L��,�U�3�4�"��	
�
�
���
������.�.��{�{���V�
	�	
��%����5��-�.�5�5�t�T�]�]�6K�L��
�
�e�rr>c�H�|�
t�}|j||fd|i|��y)a2
        Log a failure and emit a traceback.

        For example::

            try:
                frob(knob)
            except Exception:
                log.failure("While frobbing {knob}", knob=knob)

        or::

            d = deferredFrob(knob)
            d.addErrback(lambda f: log.failure("While frobbing {knob}",
                                               f, knob=knob))

        This method is generally meant to capture unexpected exceptions in
        code; an exception that is caught and handled somehow should be logged,
        if appropriate, via L{Logger.error} instead.  If some unknown exception
        occurs and your code doesn't know how to handle it, as in the above
        example, then this method provides a means to describe the failure in
        nerd-speak.  This is done at L{LogLevel.critical} by default, since no
        corrective guidance can be offered to an user/administrator, and the
        impact of the condition is unknown.

        @param format: a message format using new-style (PEP 3101) formatting.
            The logging event (which is a L{dict}) is used to render this
            format string.
        @param failure: a L{Failure} to log.  If L{None}, a L{Failure} is
            created from the exception in flight.
        @param level: a L{LogLevel} to use.
        @param kwargs: additional key/value pairs to include in the event.
            Note that values which are later mutated may result in
            non-deterministic behavior from observers that schedule work for
            later execution.
        N�log_failure)rrB)r!r1r>r0r2s     rr>zLogger.failure�s+��V�?��i�G���	�	�%��?�W�?��?rc�H�|jtj|fi|��y)a�
        Emit a log event at log level L{LogLevel.debug}.

        @param format: a message format using new-style (PEP 3101) formatting.
            The logging event (which is a L{dict}) is used to render this
            format string.

        @param kwargs: additional key/value pairs to include in the event.
            Note that values which are later mutated may result in
            non-deterministic behavior from observers that schedule work for
            later execution.
        N)rBr
�debug�r!r1r2s   rrFzLogger.debug����	��	�	�(�.�.�&�3�F�3rc�H�|jtj|fi|��y)a�
        Emit a log event at log level L{LogLevel.info}.

        @param format: a message format using new-style (PEP 3101) formatting.
            The logging event (which is a L{dict}) is used to render this
            format string.

        @param kwargs: additional key/value pairs to include in the event.
            Note that values which are later mutated may result in
            non-deterministic behavior from observers that schedule work for
            later execution.
        N)rBr
�inforGs   rrJzLogger.info����	��	�	�(�-�-��2�6�2rc�H�|jtj|fi|��y)a�
        Emit a log event at log level L{LogLevel.warn}.

        @param format: a message format using new-style (PEP 3101) formatting.
            The logging event (which is a L{dict}) is used to render this
            format string.

        @param kwargs: additional key/value pairs to include in the event.
            Note that values which are later mutated may result in
            non-deterministic behavior from observers that schedule work for
            later execution.
        N)rBr
�warnrGs   rrMzLogger.warn�rKrc�H�|jtj|fi|��y)a�
        Emit a log event at log level L{LogLevel.error}.

        @param format: a message format using new-style (PEP 3101) formatting.
            The logging event (which is a L{dict}) is used to render this
            format string.

        @param kwargs: additional key/value pairs to include in the event.
            Note that values which are later mutated may result in
            non-deterministic behavior from observers that schedule work for
            later execution.
        N)rBr
�errorrGs   rrOzLogger.error�rHrc�H�|jtj|fi|��y)a�
        Emit a log event at log level L{LogLevel.critical}.

        @param format: a message format using new-style (PEP 3101) formatting.
            The logging event (which is a L{dict}) is used to render this
            format string.

        @param kwargs: additional key/value pairs to include in the event.
            Note that values which are later mutated may result in
            non-deterministic behavior from observers that schedule work for
            later execution.
        N)rBr
�criticalrGs   rrQzLogger.critical�s��	��	�	�(�#�#�V�6�v�6r)NNN�N)rr)�__qualname__�__doc__�staticmethodrrr�objectr"�typer*r/r
rBrQrr>rFrJrMrOrrrrrs�����	�#�	��	�$(�#'�-1�	%��C�=�%��� �%��>�*�	%�

�%�:
��
�x��~�
��
�@A�#�A�8<�%��%�'/��}�%�GM�%�	
�%�T&*�"�+�+�	.@��.@��'�"�.@��	.@�
�.@�
�
.@�`
4�H�S�M�
4�F�
4�t�
4�
3�8�C�=�
3�6�
3�d�
3�
3�8�C�=�
3�6�
3�d�
3�
4�H�S�M�
4�F�
4�t�
4�
7�x��}�
7�v�
7�$�
7rrc�B�tj||j�SrR)�_logr*r')�objs r�<lambda>r[
s�����c�3�=�=�9�rN)rTr�typingrrr�twisted.python.compatr�twisted.python.failurer�_interfacesr
r�_levelsrr
rrY�
_loggerForrrr�<module>rbs<��
��&�&�.�*�/�3�w7�w7�t�x��
9�
r

Zerion Mini Shell 1.0