Logging in Python

4 projects in DevOps. Most starred: loguru, structlog and logfire.

The standard library's logging module is what almost every library writes to, with hierarchical loggers, handlers and formatters. Even if you prefer another API, configure the standard logger so third-party messages end up in the same place. Loguru replaces that setup with one preconfigured logger, readable colored output, file rotation and detailed tracebacks, which makes it pleasant for applications and scripts.

structlog produces structured logs: each event is a set of key-value pairs that can render as JSON in production and as readable lines in development, and it can wrap the standard library logger. Structured logs are much easier to search and aggregate in a log platform. Logfire, from the Pydantic team, is an observability platform built on OpenTelemetry that collects logs, traces and metrics; its SDK is open source and sends data to the hosted service.

loggingStandard library

Logging facility for Python.

structlog

Structured logging made easy.

5kupdated 7d ago26.1.0

loguru

Library which aims to bring enjoyable logging in Python.

24.2kupdated 6d ago0.7.3

logfire

The observability platform for Python, from the makers of Pydantic.

4.5kupdated today5.3.0
Esc

Type to search every entry. ↑↓ to move, Enter to open.