%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�fD��d�dZed�ZddlmZdZejZGd�d�Zdeedfd�Z	y	)
zo
Classes and utility functions for integrating Twisted and syslog.

You probably want to call L{startLogging}.
�syslog�)�logc�R�eZdZdZej
ZejZeefd�Zd�Z	y)�SyslogObserveraU
    A log observer for logging to syslog.

    See L{twisted.python.log} for context.

    This logObserver will automatically use LOG_ALERT priority for logged
    failures (such as from C{log.err()}), but you can use any priority and
    facility by setting the 'C{syslogPriority}' and 'C{syslogFacility}' keys in
    the event dict.
    c�*�|j|||�y)a�
        @type prefix: C{str}
        @param prefix: The syslog prefix to use.

        @type options: C{int}
        @param options: A bitvector represented as an integer of the syslog
            options to use.

        @type facility: C{int}
        @param facility: An indication to the syslog daemon of what sort of
            program this is (essentially, an additional arbitrary metadata
            classification for messages sent to syslog by this observer).
        N)�openlog)�self�prefix�options�facilitys    �7/usr/lib/python3/dist-packages/twisted/python/syslog.py�__init__zSyslogObserver.__init__#s��	
���V�W�h�/�c��tj|�}|�ytj}d}|drtj}d|vrt|d�}d|vrt|d�}|j
d�}|dddgk(r|j�|dddgk(r�d	}|D]4}|rd
}nd|z}|j||zdj|d
|���6y)a�
        Send a message event to the I{syslog}.

        @param eventDict: The event to send.  If it has no C{'message'} key, it
            will be ignored.  Otherwise, if it has C{'syslogPriority'} and/or
            C{'syslogFacility'} keys, these will be used as the syslog priority
            and facility.  If it has no C{'syslogPriority'} key but a true
            value for the C{'isError'} key, the B{LOG_ALERT} priority will be
            used; if it has a false value for C{'isError'}, B{LOG_INFO} will be
            used.  If the C{'message'} key is multiline, each line will be sent
            to the syslog separately.
        Nr�isError�syslogPriority�syslogFacility�
����TF�	z[{}] {}�system)	r�textFromEventDictr�LOG_INFO�	LOG_ALERT�int�split�pop�format)r	�	eventDict�text�priorityr�lines�	firstLine�lines        r
�emitzSyslogObserver.emit3s����$�$�Y�/���<���?�?�����Y���'�'�H��y�(��9�%5�6�7�H��y�(��9�%5�6�7�H��
�
�4� ���B�C�j�R�D� ��I�I�K��B�C�j�R�D� ��	��	�D��!�	��d�{���K�K��8�#�Y�%5�%5�i��6I�4�%P�
�	rN)
�__name__�
__module__�__qualname__�__doc__rr�DEFAULT_OPTIONS�DEFAULT_FACILITYrr&�rr
rrs+��	��n�n�G�
�]�]�F�'6�AQ�0� )rr�Twisted�c�`�t|||�}tj|j|��y)a
    Send all Twisted logging output to syslog from now on.

    The prefix, options and facility arguments are passed to
    C{syslog.openlog()}, see the Python syslog documentation for details. For
    other parameters, see L{twisted.python.log.startLoggingWithObserver}.
    )�	setStdoutN)rr�startLoggingWithObserverr&)r
rrr1�obss     r
�startLoggingr4_s&�����(�
3�C�� � ����Y�?rN)
r*�
__import__r�twisted.pythonrr+�LOG_USERr,rr4r-rr
�<module>r8sJ��
�
�H�	������?�?��H�H�X�o�8H�TU�@r

Zerion Mini Shell 1.0