Logging with context (contextual logging)
This library provides utilities to easily add context to logging messages and to show them, promoting a logging style that separates the log message from its contextual values.
It helps you turning this:
logger.info("Reading user %s posts", user_id)
posts = get_posts(user_id)
logger.info("User %s have %d posts", user_id, len(posts))
Into this:
with add_global_context({"user_id": user_id}):
logger.info("Reading user posts")
posts = get_posts(user_id)
logger.info("User posts readed", extra={"posts_count": len(posts)})
Documentation
You can read the docs at https://terseus.github.io/python-logging-with-context/
License
MIT
Metadata
Release files for logging-with-context 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| logging_with_context-0.2.0.tar.gz | 57.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| logging_with_context-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 64.8 kB
Release files / logging_with_context-0.2.0.tar.gz
| Download URL | logging_with_context-0.2.0.tar.gz |
|---|---|
| Size | 57.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f77e93154d5b51222676b93253fd805014341c91bda1e454803a1b5b266dd6dc
|
|
BLAKE2b-256 checksum How to use checksums |
5c671a199affbec60add7f030f4ed8288185fbdc01dccb807d6cdda4a5106988
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.5.9
|
Release files / logging_with_context-0.2.0-py3-none-any.whl
| Download URL | logging_with_context-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d00a51e84a2c395102ee8a34c9c730732b418e2507221b6e9e0684fb3a87db6
|
|
BLAKE2b-256 checksum How to use checksums |
bc1642f9ad0178858028159e5077f4219a8e7c347c24d9998a32e14f54da5fcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.5.9
|