skillfed

structlog

Structured Logging for Python

structlog Permissive license MIT OR Apache-2.0 Active 4,913 v26.1.0 released

Install

structlog on PyPI

pip

pip install structlog

uv

uv add structlog

poetry

poetry add structlog

Package 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: Apache Software LicenseLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Topic :: System :: LoggingTyping :: Typed

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...

Read as markdown · JSON record · Source repository · Docs

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.
structured logging pythonjson logging librarypython logging json outputstructured log formattingasync logging pythonlogfmt pythonproduction logging framework

Similar packages