CasperSecurity

Current Path : /lib/python3/dist-packages/twisted/logger/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/twisted/logger/__pycache__/_file.cpython-310.pyc

o

�b!	�@s�dZddlmZmZmZmZddlmZddlm	Z	ddl
mZmZm
Z
ddlmZmZee�Gdd	�d	��Ze
fd
eedeedefd
d�ZdS)z
File log observer.
�)�IO�Any�Callable�Optional)�implementer)�ioType�)�formatEventAsClassicLogText�
formatTime�timeFormatRFC3339)�ILogObserver�LogEventc@sJeZdZdZdeedeegee	fddfdd�Z
deddfd	d
�ZdS)�FileLogObserverz9
    Log observer that writes to a file-like object.
    �outFile�formatEvent�returnNcCs*t|�tur
d|_nd|_||_||_dS)z�
        @param outFile: A file-like object.  Ideally one should be passed which
            accepts text data.  Otherwise, UTF-8 L{bytes} will be used.
        @param formatEvent: A callable that formats an event.
        zutf-8N)r�str�	_encoding�_outFiler)�selfrr�r�6/usr/lib/python3/dist-packages/twisted/logger/_file.py�__init__s

zFileLogObserver.__init__�eventcCsL|�|�}|r$|jdur|j�|�n
|j�|�|j��|j��dSdS)zG
        Write event to file.

        @param event: An event.
        N)rrr�write�encode�flush)rr�textrrr�__call__(s

�zFileLogObserver.__call__)�__name__�
__module__�__qualname__�__doc__rrrr
rrrrrrrrrs��
�rr�
timeFormatrcs$dtdttf�fdd�}t||�S)a�
    Create a L{FileLogObserver} that emits text to a specified (writable)
    file-like object.

    @param outFile: A file-like object.  Ideally one should be passed which
        accepts text data.  Otherwise, UTF-8 L{bytes} will be used.
    @param timeFormat: The format to use when adding timestamp prefixes to
        logged events.  If L{None}, or for events with no C{"log_timestamp"}
        key, the default timestamp prefix of C{"-"} is used.

    @return: A file log observer.
    rrcst|�fdd�d�S)Ncs
t|��S)N�r
)�e�r#rr�<lambda>Js
z:textFileLogObserver.<locals>.formatEvent.<locals>.<lambda>r$)r	)rr&rrrHs�z(textFileLogObserver.<locals>.formatEvent)r
rrr)rr#rrr&r�textFileLogObserver8s
r(N)r"�typingrrrr�zope.interfacer�twisted.python.compatr�_formatr	r
r�_interfacesrr
rrr(rrrr�<module>s &����
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY