This project has been archived by its maintainers, and is no longer receiving any updates.
python-logger
IMPORTANT - DEPRECATION WARNING: This module is deprecated and will be archived. Do not use. Use a self-written alternative or fork this repository.
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.txtor per CLI:pip install python-json-log-formatter - Please include the
PythonLoggermodule, using afrom module import classstatement. - 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_json_log_formatter 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_json_log_formatter 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 CRITICAL, supports minor logging levels (41, etc).
To disable the logging on local machines, supply disable_log_formatting=True when configuring the logger.
Alternatively, without code changes, you can supply the ENV var DISABLE_LOG_FORMATTING"=True to generally disable it.
Every attribute of the LogRecord will be included in the formatted message unless specified in the excluded_logging_context_keys list.
Metadata
Release files for python-json-log-formatter 3.7.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 |
|---|---|---|---|---|
| python_json_log_formatter-3.7.1.tar.gz | 14.0 kB | Without provenance | Details for python_json_log_formatter-3.7.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_json_log_formatter-3.7.1-py3-none-any.whl | Python 3 | none | any | Details for python_json_log_formatter-3.7.1-py3-none-any.whl |
Total release size: 29.9 kB
Release files / python_json_log_formatter-3.7.1.tar.gz
| Download URL | python_json_log_formatter-3.7.1.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96943d6519d95279f984f12517d29a92cbd611f4e52617c02785065ada1c6676
|
|
BLAKE2b-256 checksum How to use checksums |
cda29710bce400a8268453c30846f8ab0305c40e99f5353243f379739d41b596
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / python_json_log_formatter-3.7.1-py3-none-any.whl
| Download URL | python_json_log_formatter-3.7.1-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d708972c3a324991cd22c39ba0b76bb4fbdef438fe939aa70f8c8d6fccdda986
|
|
BLAKE2b-256 checksum How to use checksums |
b59435f541fcd859f34112247769780ef2bbf4ca646189264cbd8e4cd975bf47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for python-json-log-formatter 3.7.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.