Log-Request-ID is an extension to handle request-IDs logs in popular python api frameworks.
Currently supported frameworks: flask
Requirements
python (3.6+)
Instalation
Install using pip
pip install log-request-id
Usage
Set LOG_REQUEST_ID_FRAMEWORK_SUPPORT to point to your framework of choice (section currently supported).
LOG_REQUEST_ID_FRAMEWORK_SUPPORT=flask
Init request-ID handler
Flask, with log_request_id.flask.init_flask_request_id_handler
from log_request_id import init_flask_request_id_handler
def create_flask_app():
app = Flask()
init_flask_request_id_handler(app)
Change log format (optional)
At this stage request_id is already present in log data, request-ID will be under request_id key.
logging.basicConfig(level=logging.WARNING, format='%(filename)s:%(levelname)s:%(request_id)s - %(message)s')
# or
logging.getlogger().setformatter(logging.formatter("%(asctime)s:%(name)s:level=%(levelname)s:%(request_id)s - %(message)s"))
For more advanced logger configuration see python’s logging module.
Warning if you will be adding custom handler or custom logging initialization use log_request_id.logging.RequestIdLogRecordFactory or log_request_id.logging.RequestIdLogFilter.
Metadata
Release files for log-request-id 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 |
|---|---|---|---|---|
| log_request_id-0.1.1.tar.gz | 3.8 kB | Without provenance | Details for log_request_id-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| log_request_id-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for log_request_id-0.1.1-py3-none-any.whl |
Total release size: 8.3 kB
Release files / log_request_id-0.1.1.tar.gz
| Download URL | log_request_id-0.1.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e618617af885676d6cc9c86ebb5e2834291f904c0b4e554e0cac77630e6dc2b
|
|
BLAKE2b-256 checksum How to use checksums |
a38e378ad5fbb954c6128e94fc2babb10d9f3b4ebfe5818b5d540195c953a7f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.8.15 Darwin/22.4.0
|
Release files / log_request_id-0.1.1-py3-none-any.whl
| Download URL | log_request_id-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28bcb2de6f7288b8f56b7a927eb85044fd524e7ddc36f70d694dc067a1589de9
|
|
BLAKE2b-256 checksum How to use checksums |
12e20f1877bfcf759107c77c400e0f0ecb9b27311b783e63b908c639825b61a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.8.15 Darwin/22.4.0
|
Security for log-request-id 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.