Introducing pyctxlog: Auto-Tagging Log Lines with Context

I am happy to share 🥳🥳🥳 🚀 Just shipped my first open-source Python library: pyctxlog Ever tried tracing a single request across 40 log lines and given up? That's the problem I built this for. pyctxlog is a tiny decorator that auto-tags every log line inside a function with per-call context — request id, job name, tenant, whatever you want — using contextvars so it works correctly across threads and async tasks. @log_context(fields={"job": "ingest_orders"}) def run_ingest(batch_id): log.info(f"processing {batch_id}") # every line inside is auto-tagged with job + id ✅ Sync + async auto-detected ✅ Works with Django, FastAPI, Celery, or plain functions ✅ Zero framework assumptions — truly generic ✅ Python 3.9+, MIT licensed pip install pyctxlog 🔗 https://lnkd.in/dx9HpvXt 🐙 https://lnkd.in/df4rAkR4 Feedback very welcome — this is v0.1.0 and I'd love to hear what you'd want in v0.2. #Python #OpenSource #Logging #Observability #SoftwareEngineering

  • graphical user interface, text, application

To view or add a comment, sign in

Explore content categories