/usr/lib64/python3.9/logging/__pycache__
Edit: /usr/lib64/python3.9/logging/__pycache__/handlers.cpython-39.pyc (44194B)
a
´iì ã @ sz d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z m
Z
mZ ddlZddl
Z
ddlZdZdZdZdZdZdZd ZG d
d„ dejƒZG dd
„ d
eƒZG dd„ deƒZG dd„ dejƒZG dd„ dejƒZG dd„ deƒZG dd„ dejƒZG dd„ dejƒZG dd„ dejƒZ G dd„ dejƒZ!G dd„ dejƒZ"G d d!„ d!e"ƒZ#G d"d#„ d#ejƒZ$G d$d%„ d%e%ƒZ&dS )&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 é€Q c @ s: e Zd ZdZdZdZddd„Zdd„ Zdd „ Zd
d„ Z dS )
ÚBaseRotatingHandlerz¹
Base class for handlers that rotate log files at a certain point.
Not meant to be instantiated directly. Instead, use RotatingFileHandler
or TimedRotatingFileHandler.
NFc C s. t jj| |||||d || _|| _|| _dS )zA
Use the specified filename for streamed logging
©ÚmodeÚencodingÚdelayÚerrorsN)ÚloggingÚFileHandlerÚ__init__r r r ©ÚselfÚfilenamer r r
r © r ú(/usr/lib64/python3.9/logging/handlers.pyr 6 s þzBaseRotatingHandler.__init__c C sF z$| |¡r| ¡ tj | |¡ W n ty@ | |¡ Y n0 dS )z„
Emit a record.
Output the record to the file, catering for rollover as described
in doRollover().
N)ÚshouldRolloverÚ
doRolloverr r
ÚemitÚ ExceptionÚhandleError©r Úrecordr r r r A s
zBaseRotatingHandler.emitc C s t | jƒs|}n
| |¡}|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 Zdefault_nameÚresultr r r Úrotation_filenameO s
z%BaseRotatingHandler.rotation_filenamec C s4 t | jƒs$tj |¡r0t ||¡ n| ||¡ dS )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Údestr r r Úrotateb s
zBaseRotatingHandler.rotate)NFN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r r r r r r&