%PDF- %PDF-
Direktori : /lib/python3/dist-packages/twisted/logger/__pycache__/ |
Current File : //lib/python3/dist-packages/twisted/logger/__pycache__/_observer.cpython-312.pyc |
� Ϫ�f� � � � d Z ddlmZmZ ddlmZ ddlmZ ddlm Z m Z ddlmZ dZ ee � G d � d � � Z ee � de dd fd�� Zy )z Basic log observers. � )�Callable�Optional)�implementer)�Failure� )�ILogObserver�LogEvent)�LoggerzITemporarily disabling observer {observer} due to exception: {log_failure}c �` � e Zd ZdZdeddfd�Zdeddfd�Zdeddfd�Zd eddfd �Z dede fd�Zy)�LogPublisherz� I{ILogObserver} that fans out events to other observers. Keeps track of a set of L{ILogObserver} objects and forwards events to each. � observers�returnNc �F � t |� | _ t | �� | _ y )N��observer)�list� _observersr �log)�selfr s �:/usr/lib/python3/dist-packages/twisted/logger/_observer.py�__init__zLogPublisher.__init__ s � ��y�/����4�(��� r c � � t |� st d|��� �|| j vr| j j |� yy)zq Registers an observer with this publisher. @param observer: An L{ILogObserver} to add. zObserver is not callable: N)�callable� TypeErrorr �append�r r s r �addObserverzLogPublisher.addObserver# sB � � ��!��8���E�F�F��4�?�?�*��O�O�"�"�8�,� +r c �Z � | j j |� y# t $ r Y yw xY w)zv Unregisters an observer with this publisher. @param observer: An L{ILogObserver} to remove. N)r �remove� ValueErrorr s r �removeObserverzLogPublisher.removeObserver. s+ � � ��O�O�"�"�8�,��� �� �s � � *�*�eventc �: � �� d�vrd}ndt ddf�� fd�}g }� j D ] }|� ||� |�� � |D ]. \ }}� j |� }|j t ||�� �0 y# t $ r |j |t � f� Y �rw xY w)z8 Forward events to contained observers. � log_traceNr r c �2 �� �d j �| f� y)z� Add tracing information for an observer. @param observer: an observer being forwarded to r% N)r )r r# r s ��r �tracez$LogPublisher.__call__.<locals>.traceB s �� � �k�"�)�)�4��*:�;r )�failurer )r r � Exceptionr r �_errorLoggerForObserverr( �OBSERVER_DISABLED)r r# r'