red-log
Helpful classes, functions, & utilities for the stdlib logging module. No external dependencies.
Project Links
| Site | URL |
|---|---|
| 🏠 Repository | Github: redjax/red-logging |
| 📚 Docs | ReadTheDocs |
| 🐍 Pypi | projects/red-logging |
Why?
I wanted to learn the stdlib logging module, and found I liked configuring my logger(s) with logging.config.dictConfig(). However, I did not want to have to continually check reference pages, copy/paste code, and do all the logging setup by hand each time.
red-log does not import any 3rd party modules, only Python's stdlib modules are used. This package does not necessarily aim to simplify configuring logging, but the config classes help by exposing configuration options for the logging module's formatters, handlers, and loggers.
Logger Configuration
With dictConfig()
Base config dict:
{
"version": 1,
"disable_existing_loggers": False,
"propagate": True,
"root": {},
"formatters": {},
"handlers": {},
"loggers": {}
}
from logging.config import dictConfig
logging_configdict: dict = {
"version": 1,
"disable_existing_loggers": false,
"propagate": true,
"root": {
"": {
"handlers": [
"console"
],
"level": "NOTSET"
}
},
"formatters": {
"default": {
"format": "[%(asctime)s] [%(levelname)s] > [%(filename)s:%(lineno)d] [%(funcName)s]: %(message)s",
"datefmt": "%Y-%m-%d %H:%M:%S"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "default",
"level": "DEBUG",
"stream": "ext://sys.stdout"
}
},
"loggers": {
"": {
"handlers": [
"console"
],
"level": "NOTSET"
}
}
}
dictConfig(logging_configdict)
log = logging.getLogger(__name__)
log.info("Logger configured")
Links
- python-guide.org: Logging in a library
- docs.python.org: Configuring logging for a library
- RealPython: Logging in Python
- dev.to: Using the logger class in Python
- machinelearningplus.com: Python logging guide
- askpython.com: Configure logging in Python
- betterprogramming.pub: How to implement logging in your Python application
- Medium.com: Create a reusable logger factory
Metadata
Release files for red-logging 0.1.3
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 |
|---|---|---|---|---|
| red_logging-0.1.3.tar.gz | 18.6 kB | Without provenance | Details for red_logging-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| red_logging-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for red_logging-0.1.3-py3-none-any.whl |
Total release size: 44.0 kB
Release files / red_logging-0.1.3.tar.gz
| Download URL | red_logging-0.1.3.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0acc5bd6f33a7284cb8fc70ebd52d2cfd1bf2df87b39803c47da76b4c87d07c6
|
|
BLAKE2b-256 checksum How to use checksums |
a3562dd294c5605bde1b87b28bef24b1cffb9d2b0372d3128950a526819650ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.15.4 CPython/3.11.6 Linux/5.15.0-112-generic
|
Release files / red_logging-0.1.3-py3-none-any.whl
| Download URL | red_logging-0.1.3-py3-none-any.whl |
|---|---|
| Size | 25.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f610c461732845f5ed377621a83739ed4213a95ff4886da11289ce918114fb3
|
|
BLAKE2b-256 checksum How to use checksums |
10040a8e7e5a90a52d8d58e67cc871cf5d9e4c6d949e8ebf33deb643748fab10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.15.4 CPython/3.11.6 Linux/5.15.0-112-generic
|
Security for red-logging 0.1.3
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.