Supplements a default formatter configuration for machine-readable JSON logging and applies it
Reason this release was yanked:
incorrect version increase
Project description
python-logger
Supplements a default formatter configuration for machine-readable JSON logging and applies it.
This module should be included as a sub-module in python projects with logging. Please avoid copy-pasting as no updates can be supplied that way.
Usage
- Install the module via the
requirements.txt
or per CLI:pip install python-json-log-formatter
- Please include the
PythonLogger
module, using afrom module import class
statement. - After the imports, please declare a version constant.
This constant should use semantic versioning, with a prepended date(YYYY/MM/DD)
.
Other examples, without the date, can be found here - Before any argument parsing or any other logging, the logger should be initialized
- In EVERY file, the logger needs to be imported using
LOGGER = logging.getLogger(__name__)
from python_logger import PythonLogger
import logging
VERSION = "1.0.0 (2022/11/24)"
PythonLogger.setup_logger(VERSION)
LOGGER = logging.getLogger(__name__)
Optionally, it is also possible to change the log level:
from python_logger import PythonLogger
import logging
VERSION = "1.0.0 (2022/11/24)"
PythonLogger.setup_logger(VERSION, logging.DEBUG)
LOGGER = logging.getLogger(__name__)
Features
Sets the logging format for the root logger and thus for every child logger.
In EVERY file where logging happens, please use LOGGER = logging.getLogger(__name__)
to get an individual logger.
Allows printing exception information on any logging level, not only on the EXCEPTION
level but also for INFO
or DEBUG
.
Supply exec_info
to print these.
Sets pipeline_status
and job_status
to failed
on ERROR
or CRITICAL
, supports minor logging levels (41, etc).
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
Built Distribution
Hashes for python_json_log_formatter-2.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94e4850d6c9f4e6515effd3b9a49d9ba4c74ad5da3c0df0f007d5b7192db4ae1 |
|
MD5 | 5e9397237cf5d51ab679778bf8df2a3f |
|
BLAKE2b-256 | ab16a80958133492e05414e7c29cdece9a84a4e23370b027f3a69fc41de1a638 |
Hashes for python_json_log_formatter-2.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 180741c1333a26866c33f4545bd151a29a37dfd394d74efaeeff6d827ba0904e |
|
MD5 | aa9db13abd12a7bfbeec823977352d5b |
|
BLAKE2b-256 | 8fcb4f9c6ef2d3eead4100dfbaca62b40223e3bf433ad8a2b0dfe57fa675fe7d |