structlog
Structured Logging for Python
Install
structlog on PyPI
pip
pip install structloguv
uv add structlogpoetry
poetry add structlogPackage facts
| License | MIT OR Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | actively maintained — 68 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: structlog-26.1.0-py3-none-any.whl
Keywords: log, logging, structure, structured
About structlog
from the package's own PyPI description — quoted content, verbatim
<p align="center"> <img src="https://www.structlog.org/en/stable/_static/structlog_logo_small.png" alt="structlog mascot" /> </p>
structlog is the production-ready logging solution for Python:
- Simple: Everything is about functions that take and return dictionaries – all hidden behind familiar APIs.
- Powerful: Functions and dictionaries aren’t just simple but also powerful. structlog leaves you in control.
- Fast: structlog is not hamstrung by designs of yore. Its flexibility comes not at the price of performance.
Thanks to its flexible design, you choose whether you want structlog to take care of the output of your log entries or whether you prefer to forward them to an existing logging system like the standard library's logging module.
The output format is just as flexible and structlog comes with support for JSON, logfmt, as well as pretty console output out-of-the-box:
[![Screenshot of colorful structlog output with...
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
structlog is a structured logging library that outputs logs as dictionaries through flexible APIs, supporting JSON, logfmt, and pretty console formats while optionally integrating with Python's standard logging module.
Low install friction with a single lightweight dependency (typing-extensions). Active maintenance since 2013 with a recent release 68 days ago and 4913 GitHub stars; supports Python 3.10–3.15.
Dual-licensed under MIT OR Apache-2.0 (permissive), allowing use in most commercial and open-source projects without restriction.
Usage
import structlog
log = structlog.get_logger()
log.info("event", key="value")
Requires Python 3.10 or later.
Verdict: structlog is a mature, actively maintained production logging solution with minimal dependencies, permissive licensing, and no known vulnerabilities. Its flexible architecture and support for multiple output formats make it suitable for both simple and complex logging needs.
Needs verification
- Whether the dual MIT/Apache-2.0 license requires explicit choice or is automatically resolved by downstream tooling.
- Performance characteristics compared to standard library logging under high-throughput scenarios.
Similar packages
permissive · top 100 on PyPI
argon2-cffipermissive · top 1,000 on PyPI
fastapipermissive · top 100 on PyPI
argon2-cffi-bindingspermissive · top 1,000 on PyPI
importlib-metadatapermissive · top 100 on PyPI
xgboostpermissive · top 1,000 on PyPI
marshmallowpermissive · top 1,000 on PyPI
cattrspermissive · top 1,000 on PyPI
importlib-resourcespermissive · top 1,000 on PyPI
jaraco.classespermissive · top 1,000 on PyPI