clogger
Python logger configuration, my way.
clogger is a library that helps you to configure python logging library in the way I like. It helps configuration tasks such:
- multiple handlers
- log level setting
clogger contains two classes - CustomLogger and CustomFormatter - based on default logging library.
CustomFormatter inherit and modify logging.Formatter class in order to split handler names at the last '.', to improve readability of the log.
CustomoLogger class can be used to initialize and configure logging library in a smart and easily replicable way. It also enable a (small) set of preconfigured actions.
Installation
Install clogger is as easy as run pip install clogger.
Usage
You can configure log inside your script with few code rows.
from clogger import CustomLogger
from datetime import datetime
now = datetime.now().strftime('%Y%m%d')
thisrunlog = 'thisrunlog_{}.log'.format(now)
logger = CustomLogger(
handler_name="mylog",
stream_handler=True,
file_handler=True,
filenames=["default.log", thisrunlog],
level="INFO",
)
In the above example three handlers are defined: one stream handler and two file handlers. After definition, the same logger can be modified, to hack log level of all handlers (of course, the handler must exists in the namespace to be varied):
# changing log level for all the handlers
logger.change_level('DEBUG')
# changine level for some handlers
logger.change_level('DEBUG', ["mylog", "requests"])
Two methods are definied to be immediately call at the start and at the end of a script:
logger.starting_message()
#... a lot of code...
logger.exiting_message()
Metadata
Release files for clogger 0.12.9
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 |
|---|---|---|---|---|
| clogger-0.12.9.tar.gz | 8.0 kB | Without provenance | Details for clogger-0.12.9.tar.gz |
Release files / clogger-0.12.9.tar.gz
| Download URL | clogger-0.12.9.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa16f49711f0835d36291182d030086aa07290df4086b583f4368c5cba6e0f46
|
|
BLAKE2b-256 checksum How to use checksums |
3d108d09b89394c29ac6cb75a911655e8034517c61c4b8543d25a8b21c073dc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for clogger 0.12.9
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.