Rotate logs with incremental generation numbers
Project description
JRotateLog
Rotate logs with incremental generation numbers. This is similar to the RotatingFileHandler but instead of max bytes as the rotate condition its when a new python program runs. For every run of the python code rotate the logs with the backed up files indexed start at 0.
Ex. Run python program 3 times creates 2 backups
app.log
app.log.0
app.log.1
backup_count
can be used to limit how many logs are kept.
Ex.
Run python program 4 times with backupCount = 2
app.log (from run 4)
app.log.0 (from run 3)
app.log.1 (from run 2)
app.log.2 (from run 1, deleted)
Install
pip install jrotatelog
Usage
from jrotatelog.handler import RotateFileHandler
logger = logging.getLogger("app")
fh = RotateFileHandler("app.log")
logger.addHandler(fh)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jrotatelog-0.1.0.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for jrotatelog-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a57abc2773c3e9192459cd34ad2bcf2aeafdf11bb4f5ad50ddef89ca09be891b |
|
MD5 | 94a09c373a7d62a13f1f63f732aba9bf |
|
BLAKE2b-256 | 21d255487ca5e714f98d5ec5c9a8eb41459b9107ac89f14664096bb2c1400998 |