Handlers
All logging handlers specific to this package.
Classes:
|
Handles log file and directory rotation based on log file/folder name. |
- class musify.log.handlers.CurrentTimeRotatingFileHandler(filename=None, encoding=None, when=None, interval=None, count=None, delay=False, errors=None)
Bases:
BaseRotatingHandler
Handles log file and directory rotation based on log file/folder name.
- Parameters:
filename (
str
|None
(default:None
)) – The full path to the log file. Optionally, include a ‘{}’ part in the path to format in the current datetime. When None, defaults to ‘{}.log’encoding (
str
|None
(default:None
)) – When not None, it is used to open the file with that encoding.when (
str
|None
(default:None
)) – The timespan for ‘interval’ which is used together to calculate the timedelta. Accepts same values asTimeMapper
.interval (
int
|None
(default:None
)) – The multiplier forwhen
. When combined withwhen
, gives the negative timedelta relative to now which is the maximum datetime to keep logs for.count (
int
|None
(default:None
)) – The maximum number of files to keep.delay (
bool
(default:False
)) – When True, the file opening is deferred until the first call to emit().errors (
str
|None
(default:None
)) – Used to determine how encoding errors are handled.
Attributes:
Methods:
shouldRollover
(*_, **__)Always returns False.
rotator
(unformatted, formatted)Rotates the files in the folder on the given
unformatted
path.- dt
- filename
- delta
- count
-
removed:
list
[datetime
]
- static shouldRollover(*_, **__)
Always returns False. Rotation happens on __init__ and only needs to happen once.
- Return type:
bool
- rotator(unformatted, formatted)
Rotates the files in the folder on the given
unformatted
path. Removes files older thanself.delta
and the oldest files when number of files >= count until number of files <= count.formatted
path is excluded from processing.