%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/logging/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/logging/__pycache__/handlers.cpython-312.pyc

�

���f7���x�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZddl
Z
ddlZddlZdZdZdZdZdZdZd	ZGd
�dej.�ZGd�d
e�ZGd�de�ZGd�dej.�ZGd�dej8�ZGd�de�ZGd�dej8�ZGd�dej8�Z Gd�dej8�Z!Gd�dej8�Z"Gd�dej8�Z#Gd �d!e#�Z$Gd"�d#ej8�Z%Gd$�d%e&�Z'y)&z�
Additional handlers for the logging package for Python. The core package is
based on PEP 282 and comments thereto in comp.lang.python.

Copyright (C) 2001-2021 Vinay Sajip. All Rights Reserved.

To use, simply 'import logging.handlers' and log away!
�N)�ST_DEV�ST_INO�ST_MTIMEi<#i=#i>#i?#i�Qc�2�eZdZdZdZdZdd�Zd�Zd�Zd�Z	y)�BaseRotatingHandlerz�
    Base class for handlers that rotate log files at a certain point.
    Not meant to be instantiated directly.  Instead, use RotatingFileHandler
    or TimedRotatingFileHandler.
    Nc�x�tjj||||||��||_||_||_y)zA
        Use the specified filename for streamed logging
        ��mode�encoding�delay�errorsN)�logging�FileHandler�__init__rrr��self�filenamerrr
rs      �'/usr/lib/python3.12/logging/handlers.pyrzBaseRotatingHandler.__init__6sB��	���$�$�T�8�$�.6�e�,2�	%�	4���	� ��
����c���	|j|�r|j�tjj	||�y#t
$r|j
|�YywxYw)z�
        Emit a record.

        Output the record to the file, catering for rollover as described
        in doRollover().
        N)�shouldRollover�
doRolloverrr�emit�	Exception�handleError�r�records  rrzBaseRotatingHandler.emitAsR��	%��"�"�6�*����!����$�$�T�6�2���	%����V�$�	%�s�AA�A!� A!c�Z�t|j�s|}|S|j|�}|S)a�
        Modify the filename of a log file when rotating.

        This is provided so that a custom filename can be provided.

        The default implementation calls the 'namer' attribute of the
        handler, if it's callable, passing the default name to
        it. If the attribute isn't callable (the default is None), the name
        is returned unchanged.

        :param default_name: The default name for the log file.
        )�callable�namer)r�default_name�results   r�rotation_filenamez%BaseRotatingHandler.rotation_filenameOs1����
�
�#�!�F��
��Z�Z��-�F��
rc��t|j�s7tjj	|�rtj
||�yy|j||�y)aL
        When rotating, rotate the current log.

        The default implementation calls the 'rotator' attribute of the
        handler, if it's callable, passing the source and dest arguments to
        it. If the attribute isn't callable (the default is None), the source
        is simply renamed to the destination.

        :param source: The source filename. This is normally the base
                       filename, e.g. 'test.log'
        :param dest:   The destination filename. This is normally
                       what the source is rotated to, e.g. 'test.log.1'.
        N)r �rotator�os�path�exists�rename)r�source�dests   r�rotatezBaseRotatingHandler.rotatebsC������%��w�w�~�~�f�%��	�	�&�$�'�&�
�L�L���&r)NFN)
�__name__�
__module__�__qualname__�__doc__r!r&rrr$r-�rrrr-s'���

�E��G�	�%��&'rrc�(�eZdZdZ		dd�Zd�Zd�Zy)�RotatingFileHandlerz�
    Handler for logging to a set of files, which switches from one file
    to the next when the current file reaches a certain size.
    Nc��|dkDrd}d|vrtj|�}tj||||||��||_||_y)a�
        Open the specified file and use it as the stream for logging.

        By default, the file grows indefinitely. You can specify particular
        values of maxBytes and backupCount to allow the file to rollover at
        a predetermined size.

        Rollover occurs whenever the current log file is nearly maxBytes in
        length. If backupCount is >= 1, the system will successively create
        new files with the same pathname as the base file, but with extensions
        ".1", ".2" etc. appended to it. For example, with a backupCount of 5
        and a base file name of "app.log", you would get "app.log",
        "app.log.1", "app.log.2", ... through to "app.log.5". The file being
        written to is always "app.log" - when it gets filled up, it is closed
        and renamed to "app.log.1", and if files "app.log.1", "app.log.2" etc.
        exist, then they are renamed to "app.log.2", "app.log.3" etc.
        respectively.

        If maxBytes is zero, rollover never occurs.
        r�a�b�rr
rN)�io�
text_encodingrr�maxBytes�backupCount)rrrr;r<rr
rs        rrzRotatingFileHandler.__init__|sW��6�a�<��D��d�?��'�'��1�H��$�$�T�8�T�H�+0��	%�	A� ��
�&��rc�6�|jr!|jj�d|_|jdkD�r:t|jdz
dd�D]�}|j	d|j
|fz�}|j	d|j
|dzfz�}tjj|�s�ftjj|�rt
j|�t
j||���|j	|j
dz�}tjj|�rt
j|�|j|j
|�|js|j�|_yy)z<
        Do a rollover, as described in __init__().
        Nr����z%s.%dz.1)�stream�closer<�ranger$�baseFilenamer'r(r)�remover*r-r
�_open)r�i�sfn�dfns    rrzRotatingFileHandler.doRollover�s=���;�;��K�K�����D�K����a���4�+�+�a�/��B�7�
(���,�,�W��8I�8I�1�7M�-M�N���,�,�W��8I�8I�89�A��8?�.?�@���7�7�>�>�#�&��w�w�~�~�c�*��	�	�#���I�I�c�3�'�
(��(�(��):�):�T�)A�B�C��w�w�~�~�c�"��	�	�#���K�K��)�)�3�/��z�z��*�*�,�D�K�rc���tjj|j�r*tjj	|j�sy|j
�|j
�|_|jdkDrdd|j|�z}|j
jdd�|j
j�t|�z|jk\ryy)z�
        Determine if rollover should occur.

        Basically, see if the supplied record would cause the file to exceed
        the size limit we have.
        Frz%s
�T)r'r(r)rC�isfiler@rEr;�format�seek�tell�len�rr�msgs   rrz"RotatingFileHandler.shouldRollover�s����7�7�>�>�$�+�+�,�R�W�W�^�^�D�DU�DU�5V���;�;���*�*�,�D�K��=�=�1���4�;�;�v�.�.�C��K�K���Q��"��{�{���!�C��H�,��
�
�=��r)r6rrNFN)r.r/r0r1rrrr2rrr4r4ws!���DE�48�"'�H'�.rr4c�6�eZdZdZ			dd�Zd�Zd�Zd�Zd�Zy)	�TimedRotatingFileHandlerz�
    Handler for logging to a file, rotating the log file at certain timed
    intervals.

    If backupCount is > 0, when rollover is done, no more than backupCount
    files are kept - the oldest ones are deleted.
    Nc
���tj|�}tj||d|||	��|j	�|_||_||_||_|j
dk(rd|_	d|_
d}
�n=|j
dk(rd|_	d	|_
d
}
�n|j
dk(rd|_	d
|_
d}
n�|j
dk(s|j
dk(rd|_	d|_
d}
n�|j
jd�r�d|_	t|j
�dk7rtd|j
z��|j
ddks|j
ddkDrtd|j
z��t|j
d�|_d|_
d}
ntd|j
z��t!j"|
t j$�|_|j|z|_	|j(}t*j,j/|�rt+j0|�t2}ntt5j4��}|j7|�|_y)Nr6r8�Sr>z%Y-%m-%d_%H-%M-%Sz0(?<!\d)\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}(?!\d)�M�<z%Y-%m-%d_%H-%Mz*(?<!\d)\d{4}-\d{2}-\d{2}_\d{2}-\d{2}(?!\d)�H�z%Y-%m-%d_%Hz$(?<!\d)\d{4}-\d{2}-\d{2}_\d{2}(?!\d)�D�MIDNIGHTrz%Y-%m-%dz(?<!\d)\d{4}-\d{2}-\d{2}(?!\d)�Wi�:	rJzHYou must specify a day for weekly rollover from 0 to 6 (0 is Monday): %s�0�6z-Invalid day specified for weekly rollover: %sz'Invalid rollover interval specified: %s)r9r:rr�upper�whenr<�utc�atTime�interval�suffix�
startswithrO�
ValueError�int�	dayOfWeek�re�compile�ASCII�extMatchrCr'r(r)�statr�time�computeRollover�
rolloverAt)rrr`rcr<rr
rarbrrl�ts            rrz!TimedRotatingFileHandler.__init__�s���#�#�H�-���$�$�T�8�S�8�+0��	%�	A��J�J�L��	�&����������9�9����D�M�-�D�K�J�H�
�Y�Y�#�
��D�M�*�D�K�D�H�
�Y�Y�#�
�#�D�M�'�D�K�>�H�
�Y�Y�#�
����j�!8�(�D�M�$�D�K�8�H�
�Y�Y�
!�
!�#�
&�,�D�M��4�9�9�~��"� �!k�nr�nw�nw�!w�x�x��y�y��|�c�!�T�Y�Y�q�\�C�%7� �!P�SW�S\�S\�!\�]�]� ����1��.�D�N�$�D�K�8�H��F����R�S�S��
�
�8�R�X�X�6��
��
�
��0��
��$�$��
�7�7�>�>�(�#�����!�(�+�A��D�I�I�K� �A��.�.�q�1��rc��||jz}|jdk(s|jjd��r�|jrt	j
|�}nt	j|�}|d}|d}|d}|d}|j�t}nJ|jjdz|jjzdz|jjz}||dz|zdz|zz
}	|	dkr|	tz
}	|d	zd
z}||	z}|jjd�rk|}
|
|jk7r@|
|jkr|j|
z
}nd|
z
|jzd	z}||tzz
}||jtd
zz
z
}n||jtz
z
}|jsK|d}t	j|�d}
||
k7r)|s d}t	j|d
z
�dsd}nd
}||z
}|S)zI
        Work out the rollover time based on the specified time.
        r[r\����rWrr>�r?���rY)
rcr`rerarn�gmtime�	localtimerb�	_MIDNIGHT�hour�minute�secondrh)r�currentTimer#rq�currentHour�
currentMinute�
currentSecond�
currentDay�	rotate_ts�r�day�
daysToWait�dstNow�
dstAtRollover�addends               rroz(TimedRotatingFileHandler.computeRollovers����t�}�}�,���9�9�
�"�d�i�i�&:�&:�3�&?��x�x��K�K��,���N�N�;�/���A�$�K��a�D�M��a�D�M��1��J��{�{�"�%�	�"�k�k�.�.��3�d�k�k�6H�6H�H�"�L��K�K�&�&�'�	��k�B�.��>�"�D����A��A�v��Y���(�1�n��1�
� �1�_�F� �y�y�#�#�C�(� ���$�.�.�(��T�^�^�+�%)�^�^�c�%9�
�%&��W�t�~�~�%=��%A�
��j�9�4�4�F��$�-�-�)�a�-�7�7���$�-�-�)�3�3���8�8��2��� $���v� 6�r� :�
��]�*�!�!&��#�~�~�f�T�k�:�2�>�%&�F�!%���f�$�F��
rc�0�ttj��}||jk\rjtjj|j�r@tjj|j�s|j|�|_yyy)z�
        Determine if rollover should occur.

        record is not used, as we are just comparing times, but it is needed so
        the method signatures are the same
        FT)	rgrnrpr'r(r)rCrKro)rrrqs   rrz'TimedRotatingFileHandler.shouldRolloverbsh��
��	�	����������w�w�~�~�d�/�/�0�������HY�HY�9Z�#'�"6�"6�q�"9�����rc��tjj|j�\}}tj|�}g}|j
�q|dz}t
|�}|D][}|d||k(s�||d}|jj|�s�-|jtjj||���]n�|D]�}|jj|�}	|	s�!|j|jdz|	dz�}
tjj|
�|k(r0|jtjj||����|jj||	j�dz�}	|	r����t
|�|jkrg}|S|j�|dt
|�|jz
}|S)z�
        Determine the files to delete when rolling over.

        More specific than the earlier method, which just used glob.glob().
        N�.rr>)r'r(�splitrC�listdirr!rOrl�	fullmatch�append�join�search�basename�startr<�sort)r�dirName�baseName�	fileNamesr#�prefix�plen�fileNamerd�mrHs           r�getFilesToDeletez)TimedRotatingFileHandler.getFilesToDeleteus����G�G�M�M�$�*;�*;�<�����J�J�w�'�	����:�:����^�F��v�;�D�%�
G���E�T�?�f�,�%�d�e�_�F��}�}�.�.�v�6��
�
�b�g�g�l�l�7�H�&E�F�	
G�&�
F��
�M�M�(�(��2����*�*�T�%6�%6��%<�q��t�%C�D�C��w�w�'�'��,��8��
�
�b�g�g�l�l�7�H�&E�F���
�
�,�,�X�q�w�w�y�1�}�E�A��

F��v�;��)�)�)��F��
�
�K�K�M��;�S��[�4�+;�+;�;�<�F��
rc��ttj��}|j|jz
}|jrtj
|�}nVtj|�}tj|�d}|d}||k7r|rd}nd}tj||z�}|j|jdztj|j|�z�}tjj|�ry|jr!|jj�d|_|j!|j|�|j"dkDr*|j%�D]}tj&|��|j(s|j+�|_|j-|�|_y)ax
        do a rollover; in this case, a date/time stamp is appended to the filename
        when the rollover happens.  However, you want the file to be named for the
        start of the interval, not the current time.  If there is a backup count,
        then we have to get a list of matching filenames, sort them and remove
        the one with the oldest suffix.
        r?rYrxr�Nr)rgrnrprcraryrzr$rC�strftimerdr'r(r)r@rAr-r<r�rDr
rEro)	rrrq�	timeTupler��dstThenr�rH�ss	         rrz#TimedRotatingFileHandler.doRollover�s]���$�)�)�+�&���O�O�d�m�m�+���8�8����A��I����q�)�I��^�^�K�0��4�F���m�G��� ��!�F�"�F� �N�N�1�v�:�6�	��$�$�T�%6�%6��%<�%)�]�]�4�;�;�	�%J�&K�L��
�7�7�>�>�#����;�;��K�K�����D�K����D�%�%�s�+����a���*�*�,�
���	�	�!��
��z�z��*�*�,�D�K��.�.�{�;��r)�hr>rNFFNN)	r.r/r0r1rrorr�rr2rrrSrS�s2���DE�?C��A2�FK�Z�&$�L&<rrSc�.�eZdZdZ		dd�Zd�Zd�Zd�Zy)�WatchedFileHandlera�
    A handler for logging to a file, which watches the file
    to see if it has changed while in use. This can happen because of
    usage of programs such as newsyslog and logrotate which perform
    log file rotation. This handler, intended for use under Unix,
    watches the file to see if it has changed since the last emit.
    (A file has changed if its device or inode have changed.)
    If it has changed, the old file stream is closed, and the file
    opened to get a new stream.

    This handler is not appropriate for use under Windows, because
    under Windows open files cannot be moved or renamed - logging
    opens the files with exclusive locks - and so there is no need
    for such a handler. Furthermore, ST_INO is not supported under
    Windows; stat always returns zero for this value.

    This handler is based on a suggestion and patch by Chad J.
    Schroeder.
    Nc��d|vrtj|�}tjj	||||||��d\|_|_|j�y)Nr7r
)r?r?)r9r:rrr�dev�ino�_statstreamrs      rrzWatchedFileHandler.__init__�s\���d�?��'�'��1�H����$�$�T�8�$�.6�e�,2�	%�	4�$����$�(����rc��|jrKtj|jj��}|t|t
c|_|_yy�N)r@r'�fstat�filenorrr�r��r�sress  rr�zWatchedFileHandler._statstream�sA���;�;��8�8�D�K�K�.�.�0�1�D�!%�f��t�F�|��D�H�d�h�rc��	tj|j�}|r,|t|j
k7s|t|jk7rn|j�a|jj�|jj�d|_|j�|_|j�yyy#t$rd}Y��wxYw)z�
        Reopen log file if needed.

        Checks if the underlying file has changed, and if it
        has, close the old stream and reopen the file to get the
        current stream.
        N)
r'rmrC�FileNotFoundErrorrr�rr�r@�flushrArEr�r�s  r�reopenIfNeededz!WatchedFileHandler.reopenIfNeeded�s���	��7�7�4�,�,�-�D��t�F�|�t�x�x�/�4��<�4�8�8�3K��{�{�&����!�!�#����!�!�#�"���"�j�j�l���� � �"�'�4L��!�	��D�	�s�B>�>C�Cc�d�|j�tjj||�y)z�
        Emit a record.

        If underlying file has changed, reopen the file before emitting the
        record to it.
        N)r�rrrrs  rrzWatchedFileHandler.emits&��	
������� � ��v�.r)r6NFN)r.r/r0r1rr�r�rr2rrr�r��s%���&AF���<�
#�8/rr�c�B�eZdZdZd�Zdd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�
SocketHandlera
    A handler class which writes logging records, in pickle format, to
    a streaming socket. The socket is kept open across logging calls.
    If the peer resets it, an attempt is made to reconnect on the next call.
    The pickle which is sent is that of the LogRecord's attribute dictionary
    (__dict__), so that the receiver does not need to have the logging module
    installed in order to process the logging event.

    To unpickle the record at the receiving end into a LogRecord, use the
    makeLogRecord function.
    c���tjj|�||_||_|�||_n	||f|_d|_d|_d|_d|_	d|_
d|_y)a
        Initializes the handler with a specific host address and port.

        When the attribute *closeOnError* is set to True - if a socket error
        occurs, the socket is silently closed and then reopened on the next
        logging call.
        NFg�?g>@g@)r�Handlerr�host�port�address�sock�closeOnError�	retryTime�
retryStart�retryMax�retryFactor�rr�r�s   rrzSocketHandler.__init__si��	��� � ��&���	���	��<��D�L� �$�<�D�L���	�!�����������
���rc�^�|j�#tj|j|��}|Stjtjtj
�}|j
|�	|j|j�|S#t$r|j��wxYw)zr
        A factory method which allows subclasses to define the precise
        type of socket they want.
        ��timeout)
r��socket�create_connectionr��AF_UNIX�SOCK_STREAM�
settimeout�connect�OSErrorrA)rr�r#s   r�
makeSocketzSocketHandler.makeSocket3s���
�9�9� ��-�-�d�l�l�G�L�F��
��]�]�6�>�>�6�3E�3E�F�F����g�&�
����t�|�|�,��
���
������
�s�4B�B,c��tj�}|j�d}n||jk\}|r	|j�|_d|_yy#t$r}|j�|j
|_nH|j|jz|_|j|jkDr|j|_||jz|_YywxYw)z�
        Try to create a socket, using an exponential backoff with
        a max retry time. Thanks to Robert Olson for the original patch
        (SF #815911) which has been slightly refactored.
        NT)	rnr�r�r�r�r��retryPeriodr�r�)r�now�attempts   r�createSocketzSocketHandler.createSocketDs����i�i�k���>�>�!��G��d�n�n�,�G��
8� �O�O�-��	�!%������
8��>�>�)�'+���D�$�'+�'7�'7�$�:J�:J�'J�D�$��'�'�$�-�-�7�+/�=�=��(�!$�t�'7�'7�!7���
8�s�A�BC�Cc���|j�|j�|jr	|jj|�yy#t$r$|jj	�d|_YywxYw)z�
        Send a pickled string to the socket.

        This function allows for partial sends which can happen when the
        network is busy.
        N)r�r��sendallr�rA�rr�s  r�sendzSocketHandler.send`se���9�9�������9�9�
!��	�	�!�!�!�$����
!��	�	���!� ��	�
!�s�A�*A4�3A4c�<�|j}|r|j|�}t|j�}|j	�|d<d|d<d|d<|jdd�t
j|d�}tjdt|��}||zS)z�
        Pickles the record in binary format with a length prefix, and
        returns it ready for transmission across the socket.
        rQN�args�exc_info�messager>z>L)r�rL�dict�__dict__�
getMessage�pop�pickle�dumps�struct�packrO)rr�ei�dummy�dr��slens       r�
makePicklezSocketHandler.makePickless���
�_�_��
��K�K��'�E�
����!���$�$�&��%����&�	���*�
�	���i����L�L��A����{�{�4��Q��(���a�x�rc��|jr.|jr"|jj�d|_ytjj||�y)z�
        Handle an error during logging.

        An error has occurred during logging. Most likely cause -
        connection lost. Close the socket so that we can retry on the
        next event.
        N)r�r�rArr�rrs  rrzSocketHandler.handleError�s<���������I�I�O�O���D�I��O�O�'�'��f�5rc��	|j|�}|j|�y#t$r|j|�YywxYw)a
        Emit a record.

        Pickles the record and writes it to the socket in binary format.
        If there is an error with the socket, silently drop the packet.
        If there was a problem with the socket, re-establishes the
        socket.
        N)r�r�rr)rrr�s   rrzSocketHandler.emit�s=��	%�����'�A��I�I�a�L���	%����V�$�	%�s�"%�A�Ac��|j�	|j}|rd|_|j�tjj|�|j�y#|j�wxYw�z$
        Closes the socket.
        N)�acquirer�rArr��release�rr�s  rrAzSocketHandler.close�sS��	
����	��9�9�D�� ��	��
�
���O�O�!�!�$�'��L�L�N��D�L�L�N���AA'�'A9N)r>)r.r/r0r1rr�r�r�r�rrrAr2rrr�r�
s/��
��2�"8�8!�&�,6�
%�rr�c�"�eZdZdZd�Zd�Zd�Zy)�DatagramHandlera�
    A handler class which writes logging records, in pickle format, to
    a datagram socket.  The pickle which is sent is that of the LogRecord's
    attribute dictionary (__dict__), so that the receiver does not need to
    have the logging module installed in order to process the logging event.

    To unpickle the record at the receiving end into a LogRecord, use the
    makeLogRecord function.

    c�@�tj|||�d|_y)zP
        Initializes the handler with a specific host address and port.
        FN)r�rr�r�s   rrzDatagramHandler.__init__�s��	���t�T�4�0�!��rc��|j�tj}ntj}tj|tj�}|S)zu
        The factory method of SocketHandler is here overridden to create
        a UDP socket (SOCK_DGRAM).
        )r�r�r��AF_INET�
SOCK_DGRAM)r�familyr�s   rr�zDatagramHandler.makeSocket�s;��
�9�9���^�^�F��^�^�F��M�M�&�&�"3�"3�4���rc��|j�|j�|jj||j�y)z�
        Send a pickled string to a socket.

        This function no longer allows for partial sends which can happen
        when the network is busy - UDP does not guarantee delivery and
        can deliver packets out of sequence.
        N)r�r��sendtor�r�s  rr�zDatagramHandler.send�s2���9�9�������	�	����D�L�L�)rN)r.r/r0r1rr�r�r2rrr�r��s��	�"�
�
*rr�c
�z�eZdZdZdZdZdZdZdZdZ	dZ
d	ZdZdZ
dZdZdZdZdZd	Zd
ZdZdZd
ZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#eeeeeeee
e	eeed�Z$ide�de�de�de�de�d e�d!e�d"e�d#e�d$e�d%e�d&e�d'e�d(e�d)e
�d*e�d+e�eeee e!e"e#d,��Z%d-d.d/d0d1d2�Z&d3e'fe
d4fd5�Z(d6�Z)d7�Z*d8�Z+d9�Z,d:�Z-d;Z.d<Z/d=�Z0y4)>�
SysLogHandlera
    A handler class which sends formatted logging records to a syslog
    server. Based on Sam Rushing's syslog module:
    http://www.nightmare.com/squirl/python-ext/misc/syslog.py
    Contributed by Nicolas Untz (after which minor refactoring changes
    have been made).
    rr>rJrsrtrurvrw��	�
���
����������)�alert�crit�critical�debug�emerg�err�error�info�notice�panic�warn�warning�auth�authpriv�console�cron�daemon�ftp�kern�lpr�mail�news�ntp�securityzsolaris-cron�syslog�user�uucp�local0)�local1�local2�local3�local4�local5�local6�local7rrrrr)�DEBUG�INFO�WARNING�ERROR�CRITICAL�	localhostNc��tjj|�||_||_||_d|_|j�y)a
        Initialize a handler.

        If address is specified as a string, a UNIX socket is used. To log to a
        local syslogd, "SysLogHandler(address="/dev/log")" can be used.
        If facility is not specified, LOG_USER is used. If socktype is
        specified as socket.SOCK_DGRAM or socket.SOCK_STREAM, that specific
        socket type will be used. For Unix sockets, you can also specify a
        socktype of None, in which case socket.SOCK_DGRAM will be used, falling
        back to socket.SOCK_STREAM.
        N)rr�rr��facility�socktyper�r�)rr�r6r7s    rrzSysLogHandler.__init__Js>��	��� � ��&���� ��
� ��
�������rc�L�|j}|�tj}tjtj|�|_	|jj	|�||_y#t
$r�|jj
�|j��tj}tjtj|�|_	|jj	|�||_Yy#t
$r|jj
��wxYwwxYwr�)r7r�r�r�r�r�rAr�)rr��use_socktypes   r�_connect_unixsocketz!SysLogHandler._connect_unixsocket_s����}�}����!�,�,�L��m�m�F�N�N�L�A���	��K�K����(�(�D�M���
	��K�K�����}�}�(��!�-�-�L� �-�-�����E�D�K�
����#�#�G�,� ,��
���
����!�!�#��
��
	�s�	"A,�,A)D#�"C:�:%D�D#c�D�|j}|j}t|t�rd|_	|j|�yd|_|�tj}|\}}tj||d|�}|st
d��|D]K}|\}}}}	}
dx}}	tj|||�}|tjk(r|j|
�n�|�|_||_y#t$rYywxYw#t$r}
|
}|�|j�Yd}
~
��d}
~
wwxYw)af
        Try to create a socket and, if it's not a datagram socket, connect it
        to the other end. This method is called during handler initialization,
        but it's not regarded as an error if the other end isn't listening yet
        --- the method will be called again when emitting an event,
        if there is no socket at that point.
        TFNrz!getaddrinfo returns an empty list)
r�r7�
isinstance�str�
unixsocketr:r�r�r��getaddrinfor�r�rA)rr�r7r�r��ress�res�af�proto�_�sarr��excs              rr�zSysLogHandler.createSocketws3���,�,���=�=���g�s�#�"�D�O�

��(�(��1�$�D�O���!�,�,�� �J�D�$��%�%�d�D�!�X�>�D���A�B�B��
%��-0�*��H�e�Q��!�!��d�%�!�=�=��X�u�=�D��6�#5�#5�5����R�(��
%����	��D�K�$�D�M��3�
��
��$�%��C��'��
�
����%�s)�C)�;C8�)	C5�4C5�8	D�D�Dc��t|t�r|j|}t|t�r|j|}|dz|zS)z�
        Encode the facility and priority. You can pass in strings or
        integers - if strings are passed, the facility_names and
        priority_names mapping dictionaries are used to convert them to
        integers.
        rs)r<r=�facility_names�priority_names)rr6�prioritys   r�encodePriorityzSysLogHandler.encodePriority�sG���h��$��*�*�8�4�H��h��$��*�*�8�4�H��A�
��)�)rc��|j�	|j}|rd|_|j�tjj|�|j�y#|j�wxYwr�)r�r�rArr�r�r�s  rrAzSysLogHandler.close�sS��	
����	��;�;�D��"����
�
���O�O�!�!�$�'��L�L�N��D�L�L�N�r�c�:�|jj|d�S)aK
        Map a logging level name to a key in the priority_names map.
        This is useful in two scenarios: when custom levels are being
        used, and in the case where you can't do a straightforward
        mapping by lowercasing the logging level name because of locale-
        specific issues (see SF #1524081).
        r)�priority_map�get)r�	levelNames  r�mapPriorityzSysLogHandler.mapPriority�s��� � �$�$�Y�	�:�:r�Tc��	|j|�}|jr|j|z}|jr|dz
}d|j|j|j|j��z}|jd�}|jd�}||z}|js|j�|jr	|jj|�y|j tj"k(r'|jj%||j�y|jj'|�y#t$rS|jj�|j|j�|jj|�YywxYw#t($r|j+|�YywxYw)z�
        Emit a record.

        The record is formatted, and then sent to the syslog server. If
        exception information is present, it is NOT sent to the server.
        �z<%d>�utf-8N)rL�ident�
append_nulrKr6rQ�	levelname�encoder�r�r>r�r�rAr:r�r7r�r�r�rr)rrrQ�prios    rrzSysLogHandler.emit�sf��	%��+�+�f�%�C��z�z��j�j�3�&������v�
���D�/�/��
�
�04�0@�0@��AQ�AQ�0R�T�T�D��;�;�w�'�D��*�*�W�%�C���*�C��;�;��!�!�#����*��K�K�$�$�S�)�
���&�"3�"3�3����"�"�3����5����#�#�C�(���*��K�K�%�%�'��,�,�T�\�\�:��K�K�$�$�S�)�*���	%����V�$�	%�s>�CF"�E�#AF"�'F"�AF�F"�F�F"�"F?�>F?)1r.r/r0r1�	LOG_EMERG�	LOG_ALERT�LOG_CRIT�LOG_ERR�LOG_WARNING�
LOG_NOTICE�LOG_INFO�	LOG_DEBUG�LOG_KERN�LOG_USER�LOG_MAIL�
LOG_DAEMON�LOG_AUTH�
LOG_SYSLOG�LOG_LPR�LOG_NEWS�LOG_UUCP�LOG_CRON�LOG_AUTHPRIV�LOG_FTP�LOG_NTP�LOG_SECURITY�LOG_CONSOLE�LOG_SOLCRON�
LOG_LOCAL0�
LOG_LOCAL1�
LOG_LOCAL2�
LOG_LOCAL3�
LOG_LOCAL4�
LOG_LOCAL5�
LOG_LOCAL6�
LOG_LOCAL7rIrHrN�SYSLOG_UDP_PORTrr:r�rKrArQrVrWrr2rrr�r��s���$�I��I��H��G��K��J��H��I��H��H��H��J��H��J��G��H��H��H��L��G��G��L��K��K��J��J��J��J��J��J��J��J�������������

�N�
���
���
�	��
�	��	
�
	�
�
�	��

�	��
�	��
�	��
�	��
�	��
�	��
�	��
�	�
�
�	��
� 	��!
�"	�
�#
�$#�"�"�"�"�"�"�1
�N�<������L�!,�_�=�"�T��*�0,%�\*��;�
�E��J�&%rr�c�&�eZdZdZ	dd�Zd�Zd�Zy)�SMTPHandlerzK
    A handler class which sends an SMTP email for each logging event.
    Nc�r�tjj|�t|tt
f�r|\|_|_n|dc|_|_t|tt
f�r|\|_|_	nd|_||_
t|t�r|g}||_||_
||_||_y)ax
        Initialize the handler.

        Initialize the instance with the from and to addresses and subject
        line of the email. To specify a non-standard SMTP port, use the
        (host, port) tuple format for the mailhost argument. To specify
        authentication credentials, supply a (username, password) tuple
        for the credentials argument. To specify the use of a secure
        protocol (TLS), pass in a tuple for the secure argument. This will
        only be used when authentication credentials are supplied. The tuple
        will be either an empty tuple, or a single-value tuple with the name
        of a keyfile, or a 2-value tuple with the names of the keyfile and
        certificate file. (This tuple is passed to the `starttls` method).
        A timeout in seconds can be specified for the SMTP connection (the
        default is one second).
        N)rr�rr<�list�tuple�mailhost�mailport�username�password�fromaddrr=�toaddrs�subject�securer�)rr�r�r�r��credentialsr�r�s        rrzSMTPHandler.__init__�s���$	��� � ��&��h��u�
�.�+3�(�D�M�4�=�+3�T�(�D�M�4�=��k�D�%�=�1�+6�(�D�M�4�=� �D�M� ��
��g�s�#��i�G������������rc��|jS)z�
        Determine the subject for the email.

        If you want to specify a subject line which is record-dependent,
        override this method.
        )r�rs  r�
getSubjectzSMTPHandler.getSubjects���|�|�rc� �	ddl}ddlm}ddl}|j}|s|j
}|j
|j||j��}|�}|j|d<dj|j�|d<|j|�|d<|jj�|d	<|j|j!|��|j"rk|j$�9|j'�|j(|j$�|j'�|j+|j"|j,�|j/|�|j1�y#t2$r|j5|�YywxYw)
zd
        Emit a record.

        Format the record and send it to the specified addressees.
        rN)�EmailMessager��From�,�To�Subject�Date)�smtplib�
email.messager��email.utilsr��	SMTP_PORT�SMTPr�r�r�r�r�r��utilsrz�set_contentrLr�r��ehlo�starttls�loginr��send_message�quitrr)rrr�r��emailr��smtprQs        rrzSMTPHandler.emit%s)��	%��2���=�=�D���(�(���<�<��
�
�t�T�\�\�<�J�D��.�C��-�-�C��K�������.�C��I�!�_�_�V�4�C�	�N��+�+�/�/�1�C��K��O�O�D�K�K��/�0��}�}��;�;�*��I�I�K�!�D�M�M�4�;�;�/��I�I�K��
�
�4�=�=�$�-�-�8����c�"��I�I�K���	%����V�$�	%�s�E-E0�0F
�F
)NNg@)r.r/r0r1rr�rr2rrr}r}�s���9<�!�F�%rr}c�6�eZdZdZd	d�Zd�Zd�Zd�Zd�Zd�Z	y)
�NTEventLogHandlera�
    A handler class which sends events to the NT Event Log. Adds a
    registry entry for the specified application name. If no dllname is
    provided, win32service.pyd (which contains some basic message
    placeholders) is used. Note that use of these placeholders will make
    your event logs big, as the entire message source is held in the log.
    If you want slimmer logs, you have to pass in the name of your own DLL
    which contains the message definitions you want to use in the event log.
    Nc
��tjj|�	ddl}ddl}||_||_|sxtjj|jj�}tjj|d�}tjj|dd�}||_||_
	|jj|||�|j"|_tj&|j(tj*|j(tj,|j.tj0|j"tj2|j"i|_y#t$r}t!|dd�dk7r�Yd}~��d}~wwxYw#t6$rt9d�d|_YywxYw)Nrzwin32service.pyd�winerrorruzWThe Python Win32 extensions for NT (service, event logging) appear not to be available.)rr�r�win32evtlogutil�win32evtlog�appname�_welur'r(r��__file__r��dllname�logtype�AddSourceToRegistryr�getattr�EVENTLOG_ERROR_TYPE�deftyper/�EVENTLOG_INFORMATION_TYPEr0r1�EVENTLOG_WARNING_TYPEr2r3�typemap�ImportError�print)rr�r�r�r�r��es       rrzNTEventLogHandler.__init__OsX����� � ��&�	�/�"�D�L�(�D�J���'�'�-�-��
�
�(;�(;�<���'�'�-�-���
�3���'�'�,�,�w�q�z�3F�G��"�D�L�"�D�L�
��
�
�.�.�w���I�'�:�:�D�L��
�
�+�"G�"G����+�"G�"G����+�"C�"C��
�
�+�"A�"A�� � �+�"A�"A��D�L��
�
��1�j�$�/�1�4��5��
���	��?�
@��D�J�	�s=�BF�E8�BF�8	F�F�F�F�F�F=�<F=c��y)ay
        Return the message ID for the event record. If you are using your
        own messages, you could do this by having the msg passed to the
        logger being an ID rather than a formatting string. Then, in here,
        you could use a dictionary lookup to get the message ID. This
        version returns 1, which is the base message ID in win32service.pyd.
        r>r2rs  r�getMessageIDzNTEventLogHandler.getMessageIDrs��rc��y)z�
        Return the event category for the record.

        Override this if you want to specify your own categories. This version
        returns 0.
        rr2rs  r�getEventCategoryz"NTEventLogHandler.getEventCategory|s��rc�b�|jj|j|j�S)a�
        Return the event type for the record.

        Override this if you want to specify your own types. This version does
        a mapping using the handler's typemap attribute, which is set up in
        __init__() to a dictionary which contains mappings for DEBUG, INFO,
        WARNING, ERROR and CRITICAL. If you are using your own levels you will
        either need to override this method or place a suitable dictionary in
        the handler's typemap attribute.
        )r�rO�levelnor�rs  r�getEventTypezNTEventLogHandler.getEventType�s#���|�|���������=�=rc�<�|jrp	|j|�}|j|�}|j|�}|j	|�}|jj|j||||g�yy#t$r|j|�YywxYw)z�
        Emit a record.

        Determine the message ID, event category and event type. Then
        log the message in the NT event log.
        N)	r�r�r�r�rL�ReportEventr�rr)rr�id�cat�typerQs      rrzNTEventLogHandler.emit�s����:�:�
)��&�&�v�.���+�+�F�3���(�(��0���k�k�&�)���
�
�&�&�t�|�|�R��d�S�E�J�
���
)�� � ��(�
)�s�A.A>�>B�Bc�B�tjj|�y)aS
        Clean up this handler.

        You can remove the application name from the registry as a
        source of event log entries. However, if you do this, you will
        not be able to see the events as you intended in the Event Log
        Viewer - it needs to be able to access the registry to get the
        DLL name.
        N)rr�rA�rs rrAzNTEventLogHandler.close�s��	�����d�#r)N�Application)
r.r/r0r1rr�r�r�rrAr2rrr�r�Es&���!�F��>�)�"$rr�c�.�eZdZdZ		dd�Zd�Zd�Zd�Zy)�HTTPHandlerz^
    A class which sends records to a web server, using either GET or
    POST semantics.
    Nc���tjj|�|j�}|dvrt	d��|s
|�t	d��||_||_||_||_||_	||_
y)zr
        Initialize the instance with the host, the request URL, and the method
        ("GET" or "POST")
        )�GET�POSTzmethod must be GET or POSTNz3context parameter only makes sense with secure=True)rr�rr_rfr��url�methodr�r��context)rr�r�r�r�r�r�s       rrzHTTPHandler.__init__�sz��	��� � ��&��������(��9�:�:��'�-��0�1�
1���	����������&�����rc��|jS)z�
        Default implementation of mapping the log record into a dict
        that is sent as the CGI data. Overwrite in your class.
        Contributed by Franz Glasner.
        )r�rs  r�mapLogRecordzHTTPHandler.mapLogRecord�s�����rc��ddl}|r)|jj||j��}|S|jj	|�}|S)z�
        get a HTTP[S]Connection.

        Override when a custom connection is required, for example if
        there is a proxy.
        rN)r�)�http.client�client�HTTPSConnectionr��HTTPConnection)rr�r��http�
connections     r�
getConnectionzHTTPHandler.getConnection�sK��	�����4�4�T�4�<�<�4�P�J������3�3�D�9�J��rc���	ddl}|j}|j||j�}|j}|j
j
|j|��}|jdk(r#|jd�dk\rd}nd}|d||fzz}|j|j|�|jd�}|dk\r|d|}|jdk(r6|jd	d
�|jdtt|���|jreddl}	d|jzj!d
�}
d|	j#|
�j%�j'd�z}
|jd|
�|j)�|jdk(r |j+|j!d
��|j-�y#t.$r|j1|�YywxYw)zk
        Emit a record.

        Send the record to the web server as a percent-encoded dictionary
        rNr��?�&z%c%s�:r�zContent-typez!application/x-www-form-urlencodedzContent-lengthz%s:%srUzBasic �ascii�
Authorization)�urllib.parser�r�r�r��parse�	urlencoder�r��find�
putrequest�	putheaderr=rOr��base64rY�	b64encode�strip�decode�
endheadersr��getresponserr)rr�urllibr�r�r��data�seprFr�r�s           rrzHTTPHandler.emit�s���#	%���9�9�D��"�"�4����5�A��(�(�C��<�<�)�)�$�*;�*;�F�*C�D�D��{�{�e�#��H�H�S�M�Q�&��C��C��F�c�4�[�0�0��
�L�L����c�*��	�	�#��A��A�v��B�Q�x���{�{�f�$����N�?�A����,�c�#�d�)�n�=������t�/�/�/�7�7��@���v�/�/��2�8�8�:�A�A�'�J�J�����O�Q�/�
�L�L�N��{�{�f�$����t�{�{�7�+�,�
�M�M�O���	%����V�$�	%�s�GG�G0�/G0)r�FNN)r.r/r0r1rr�r�rr2rrr�r��s%���KO���(��)%rr�c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�BufferingHandlerz�
  A handler class which buffers logging records in memory. Whenever each
  record is added to the buffer, a check is made to see if the buffer should
  be flushed. If it should, then flush() is expected to do what's needed.
    c�^�tjj|�||_g|_y)z>
        Initialize the handler with the buffer size.
        N)rr�r�capacity�buffer)rr�s  rrzBufferingHandler.__init__s$��	��� � ��&� ��
���rc�F�t|j�|jk\S)z�
        Should the handler flush its buffer?

        Returns true if the buffer is up to capacity. This method can be
        overridden to implement custom flushing strategies.
        )rOr�r�rs  r�shouldFlushzBufferingHandler.shouldFlushs���D�K�K� �D�M�M�1�2rc�~�|jj|�|j|�r|j�yy)z�
        Emit a record.

        Append the record. If shouldFlush() tells us to, call flush() to process
        the buffer.
        N)r�r�r�r�rs  rrzBufferingHandler.emit!s2��	
�����6�"����F�#��J�J�L�$rc��|j�	|jj�|j�y#|j�wxYw)zw
        Override to implement custom flushing behaviour.

        This version just zaps the buffer to empty.
        N)r�r��clearr�r�s rr�zBufferingHandler.flush,s5��	
����	��K�K�����L�L�N��D�L�L�N�s	�=�Ac��	|j�tjj|�y#tjj|�wxYw)zp
        Close the handler.

        This version just flushes and chains to the parent class' close().
        N)r�rr�rAr�s rrAzBufferingHandler.close8s5��	(��J�J�L��O�O�!�!�$�'��G�O�O�!�!�$�'�s	�2�!AN)	r.r/r0r1rr�rr�rAr2rrr�r�
s ���
�3�	�
�	(rr�c�J�eZdZdZej
ddfd�Zd�Zd�Zd�Z	d�Z
y)	�
MemoryHandlerz�
    A handler class which buffers logging records in memory, periodically
    flushing them to a target handler. Flushing occurs whenever the buffer
    is full, or when an event of a certain severity or greater is seen.
    NTc�Z�tj||�||_||_||_y)a;
        Initialize the handler with the buffer size, the level at which
        flushing should occur and an optional target.

        Note that without a target being set either here or via setTarget(),
        a MemoryHandler is no use to anyone!

        The ``flushOnClose`` argument is ``True`` for backward compatibility
        reasons - the old behaviour is that when the handler is closed, the
        buffer is flushed, even if the flush level hasn't been exceeded nor the
        capacity exceeded. To prevent this, set ``flushOnClose`` to ``False``.
        N)r�r�
flushLevel�target�flushOnClose)rr�r�r�r�s     rrzMemoryHandler.__init__Is*��	�!�!�$��1�$������(��rc�|�t|j�|jk\xs|j|jk\S)zP
        Check for buffer full or a record at the flushLevel or higher.
        )rOr�r�r�r�rs  rr�zMemoryHandler.shouldFlush]s3���D�K�K� �D�M�M�1�4����4�?�?�2�	4rc�~�|j�	||_|j�y#|j�wxYw)z:
        Set the target handler for this handler.
        N)r�r�r�)rr�s  r�	setTargetzMemoryHandler.setTargetds,��	
����	� �D�K��L�L�N��D�L�L�N�s�*�<c��|j�	|jrF|jD]}|jj|��|jj	�|j�y#|j�wxYw)z�
        For a MemoryHandler, flushing means just sending the buffered
        records to the target, if there is one. Override if you want
        different behaviour.

        The record buffer is only cleared if a target has been set.
        N)r�r�r��handler�r�rs  rr�zMemoryHandler.flushnsa��	
����	��{�{�"�k�k�/�F��K�K�&�&�v�.�/����!�!�#��L�L�N��D�L�L�N�s�AA5�5Bc��	|jr|j�|j�	d|_tj|�|j
�y#|j
�wxYw#|j�	d|_tj|�|j
�w#|j
�wxYwxYw)zi
        Flush, if appropriately configured, set the target to None and lose the
        buffer.
        N)r�r�r�r�r�rAr�r�s rrAzMemoryHandler.closes���
		�� � ��
�
���L�L�N�
�"��� �&�&�t�,�����������
�L�L�N�
�"��� �&�&�t�,����������s.�A1�A�A.�1C�B0�C�0C�C)r.r/r0r1rr2rr�r�r�rAr2rrr�r�Cs.���
-4�M�M�$�"�)�(4���"rr�c�(�eZdZdZd�Zd�Zd�Zd�Zy)�QueueHandlera�
    This handler sends events to a queue. Typically, it would be used together
    with a multiprocessing Queue to centralise logging to file in one process
    (in a multi-process application), so as to avoid file write contention
    between processes.

    This code is new in Python 3.2, but this class can be copy pasted into
    user code for use with earlier Python versions.
    c�^�tjj|�||_d|_y)zA
        Initialise an instance, using the passed queue.
        N)rr�r�queue�listener)rrs  rrzQueueHandler.__init__�s$��	��� � ��&���
���
rc�:�|jj|�y)z�
        Enqueue a record.

        The base implementation uses put_nowait. You may want to override
        this method if you want to use blocking, timeouts or custom queue
        implementations.
        N)r�
put_nowaitrs  r�enqueuezQueueHandler.enqueue�s��	
�
�
���f�%rc��|j|�}tj|�}||_||_d|_d|_d|_d|_|S)a�
        Prepare a record for queuing. The object returned by this method is
        enqueued.

        The base implementation formats the record to merge the message and
        arguments, and removes unpickleable items from the record in-place.
        Specifically, it overwrites the record's `msg` and
        `message` attributes with the merged message (obtained by
        calling the handler's `format` method), and sets the `args`,
        `exc_info` and `exc_text` attributes to None.

        You might want to override this method if you want to convert
        the record to a dict or JSON string, or send a modified copy
        of the record while leaving the original intact.
        N)rL�copyr�rQr�r��exc_text�
stack_inforPs   r�preparezQueueHandler.prepare�sP��,�k�k�&�!�����6�"�������
���������� ����
rc��	|j|j|��y#t$r|j|�YywxYw)zm
        Emit a record.

        Writes the LogRecord to the queue, preparing it for pickling first.
        N)r
rrrrs  rrzQueueHandler.emit�s9��	%��L�L����f�-�.���	%����V�$�	%�s� #�A�AN)r.r/r0r1rr
rrr2rrrr�s����&��B	%rrc�J�eZdZdZdZdd�d�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zy)
�
QueueListenerz�
    This class implements an internal threaded listener which watches for
    LogRecords being added to a queue, removes them and passes them to a
    list of handlers for processing.
    NF)�respect_handler_levelc�<�||_||_d|_||_y)zW
        Initialise an instance with the specified queue and
        handlers.
        N)r�handlers�_threadr)rrrrs    rrzQueueListener.__init__�s!��
��
� ��
����%:��"rc�8�|jj|�S)z�
        Dequeue a record and return it, optionally blocking.

        The base implementation uses get. You may want to override this method
        if you want to use timeouts or work with custom queue implementations.
        )rrO)r�blocks  r�dequeuezQueueListener.dequeue�s���z�z�~�~�e�$�$rc��tj|j��x|_}d|_|j�y)z�
        Start the listener.

        This starts up a background thread to monitor the queue for
        LogRecords to process.
        )r�TN)�	threading�Thread�_monitorrrr�)rrqs  rr�zQueueListener.start�s/��%�+�+�4�=�=�A�A���q����	���	rc��|S)a
        Prepare a record for handling.

        This method just returns the passed-in record. You may want to
        override this method if you need to do any custom marshalling or
        manipulation of the record before passing it to the handlers.
        r2rs  rrzQueueListener.prepares	���
rc��|j|�}|jD]>}|jsd}n|j|jk\}|s�.|j|��@y)z|
        Handle a record.

        This just loops through the handlers offering them the record
        to handle.
        TN)rrrr��levelr)rr�handler�processs    rrzQueueListener.handle
sT�����f�%���}�}�	'�G��-�-��� �.�.�G�M�M�9������v�&�
	'rc��|j}t|d�}		|jd�}||jur|r|j	�y|j|�|r|j	��W#tj$rYywxYw)z�
        Monitor the queue for records, and ask the handler
        to deal with them.

        This method runs on a separate, internal thread.
        The thread will terminate if it sees a sentinel object in the queue.
        �	task_doneTN)r�hasattrr�	_sentinelr$r�Empty)r�q�
has_task_doners    rrzQueueListener._monitors��
�J�J����;�/�
��

����d�+���T�^�^�+�$����
�����F�#� ��K�K�M����;�;�
��
�s�1A1�
#A1�1B�Bc�N�|jj|j�y)z�
        This is used to enqueue the sentinel record.

        The base implementation uses put_nowait. You may want to override this
        method if you want to use timeouts or work with custom queue
        implementations.
        N)rr	r&r�s r�enqueue_sentinelzQueueListener.enqueue_sentinel1s��	
�
�
���d�n�n�-rc�f�|j�|jj�d|_y)a

        Stop the listener.

        This asks the thread to terminate, and then waits for it to do so.
        Note that if you don't call this before your application exits, there
        may be some records still left on the queue, which won't be processed.
        N)r+rr�r�s r�stopzQueueListener.stop;s'��	
������������r)
r.r/r0r1r&rrr�rrrr+r-r2rrrr�s9���
�I�?D�;�%�	��'� �..�
rr)(r1r9rr�r'r�r�rnrirmrrrrrr�DEFAULT_TCP_LOGGING_PORT�DEFAULT_UDP_LOGGING_PORT�DEFAULT_HTTP_LOGGING_PORT�DEFAULT_SOAP_LOGGING_PORTr{�SYSLOG_TCP_PORTr{rrr4rSr�r�r�r�r�r}r�r�r�r�r�objectrr2rr�<module>r4sH��"�9�8�8�8�)�)����#��"��"��"��!��!���	�H'�'�-�-�H'�TQ�-�Q�fw<�2�w<�rG/��,�,�G/�Te�G�O�O�e�N(*�m�(*�TU%�G�O�O�U%�nN%�'�/�/�N%�`i$����i$�VX%�'�/�/�X%�t7(�w���7(�rJ�$�J�ZG%�7�?�?�G%�Tk�F�kr

Zerion Mini Shell 1.0