![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /lib/python3/dist-packages/twisted/python/__pycache__/ |
o �bD � @ sF d Z ed�ZddlmZ dZejZG dd� d�Zdeedfdd �Z d S )zo Classes and utility functions for integrating Twisted and syslog. You probably want to call L{startLogging}. �syslog� )�logc @ s2 e Zd ZdZejZejZeefdd�Zdd� Z dS )�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 C s | � |||� dS )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�facility� r �7/usr/lib/python3/dist-packages/twisted/python/syslog.py�__init__# s zSyslogObserver.__init__c C s� t �|�}|du rdS tj}d}|d rtj}d|v r!t|d �}d|v r+t|d �}|�d�}|dd� dgkrF|�� |dd� dgks9d }|D ]}|rQd }nd| }| �||B d�|d |�� qJdS )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�liner r r �emit3 s0 ���zSyslogObserver.emitN) �__name__� __module__�__qualname__�__doc__r r �DEFAULT_OPTIONS�DEFAULT_FACILITYr r"