codechu-log
Stdlib-only structured logging for Python 3.10+. One call configures a
rotating file handler, a TTY-aware console handler, optional JSON output,
and a redaction list. Context is propagated through contextvars so it
works across await boundaries.
from codechu_log import setup, bind, Context
log = bind(setup("myapp", file="app.log", json=True), service="api")
with Context(request_id="r-42"):
log.info("started", user="onur")
Output (one JSON object per line):
{"ts": "2026-05-20T12:34:56.789012+00:00", "level": "INFO",
"logger": "myapp", "msg": "started",
"fields": {"service": "api", "request_id": "r-42", "user": "onur"},
"exc_info": null, "pid": 4321, "thread": "MainThread"}
Features
setup(name, *, level, file, json, max_bytes, backup_count, fmt, redact)— one-call configuration withRotatingFileHandlerand a TTY-aware console handler.Context(**fields)— context manager backed bycontextvars; nested scopes merge, child wins on key conflict, propagation survivesawait.bind(logger, **fields)— always-on fields per logger.structured(logger)—log.info("msg", key=value)lifts kwargs into the structured payload.redact=[...]— replace listed field keys with<redacted>in both text and JSON output.
Install
pip install codechu-log
Documentation
- API reference — every public symbol and the JSON schema.
- Recipes — common configurations.
- CHANGELOG
License
MIT — see LICENSE.
Metadata
Release files for codechu-log 0.1.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 | |
|---|---|---|---|
| codechu_log-0.1.0.tar.gz | 10.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| codechu_log-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.7 kB
Release files / codechu_log-0.1.0.tar.gz
| Download URL | codechu_log-0.1.0.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da4bd848df1e2ef45ff171b8bb04565dfd23df94b852a934810af62289cd409d
|
|
BLAKE2b-256 checksum How to use checksums |
4321c024b2164ddba24efbc944a4dcb55252f9c581cc82c4754bd327ff47cd21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency logRelease files / codechu_log-0.1.0-py3-none-any.whl
| Download URL | codechu_log-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
616d3c25b0dd9d99ec8be94f7815d655927abd191cdf9cf09f6e9e9f39ec7e2a
|
|
BLAKE2b-256 checksum How to use checksums |
ecc9ae1cac86fd0499a72edce5aed3aaa7a58dd9620e0cdebfd7a29d7ae1595e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency log