ATRFileHandler
ATRFileHandler, or AbsoluteTimedRotatingFileHandler, is a file handler like TimedRotatingFileHandler that also caches the next rollover time for your logfiles, allowing future instances of your application to rotate the logfile in schedule, avoiding surprices of large logfiles that haven't rotated as you expected.
Diferences with TimedRotatingFileHandler
The main difference is that instead of only using the handler creation time to calculate the next rollover, it also writes and reads it from a cache file. With TimeRotatingFileHandler, if you want to rotate logs daily but your process starts and ends in a couple of minutes, when you run it in one hour the logfile will not rotate, because the handler won't remember the last time it was used. ATRHandler will rotate it because it saves this data to a file cache.
This allows you to easily keep weekly logfiles for a periodic shot-lived process, without making that process into a service or long running process.
Install
With pip:
pip install ATRFileHandler
Usage
It can be used exactly as the TimedRotatingFileHandler from the builting logging module.
Example:
import logging
from ATRFileHandler import ATRFileHandler
logger = logging.getLogger()
handler = ATRFileHandler("test.log", when="D", interval=3, backupCount=3)
logger.addHandler(handler)
logger.error("too much rythm")
Running tests
pip install -e .
pytest --cov=ATRFileHandler/
Metadata
Release files for ATRFileHandler 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ATRFileHandler-0.1.1.tar.gz | 15.8 kB | Without provenance | Details for ATRFileHandler-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ATRFileHandler-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ATRFileHandler-0.1.1-py3-none-any.whl |
Total release size: 30.8 kB
Release files / ATRFileHandler-0.1.1.tar.gz
| Download URL | ATRFileHandler-0.1.1.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fb63947a1e37c702fe90bea4e57fe2663bc385cd7ec05de7eb4f28978185161
|
|
BLAKE2b-256 checksum How to use checksums |
3983b7969301617b1076b61ea17fb96bdb4dc029066eaf1eb3a34374089af25a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.11
|
Release files / ATRFileHandler-0.1.1-py3-none-any.whl
| Download URL | ATRFileHandler-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e9eee7c204f884caecff073d45bacb6bc9af9b00fe5b3f4bfa81ba34d07d837
|
|
BLAKE2b-256 checksum How to use checksums |
72cb350c1a9dfa7d12013995b84b01037eeb7cd70b4564af79e963551585fd62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.11
|
Security for ATRFileHandler 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.