Fapilog - Batteries-included, async-first logging for Python services

fapilog is a high-performance logging pipeline that eliminates the bottlenecks of traditional Python logging. By replacing blocking I/O with a lock-free, async-native architecture, it ensures your application never stalls to write a log. While it’s an excellent choice for FastAPI and microservices, its lightweight footprint and pluggable sinks make it equally powerful for on-prem, desktop, or embedded projects.

Stability: Core logger and FastAPI middleware are beta/stable under semver.

Why Fapilog?

Traditional logging libraries block your application, lose context, and produce unstructured output. Fapilog gives you:

  • Async-first - Never block your application again

  • Structured - JSON logs that machines can actually parse

  • Production-ready - Built-in redaction, metrics, and resilience

  • High-performance - Lock-free queues and zero-copy processing

Read more about why fapilog → | See all features → | Compare with alternatives →

Quick Example

from fapilog import get_async_logger

# Zero-config, works immediately (async)
logger = await get_async_logger()
await logger.info("User logged in", user_id="123")

# Automatic context binding
await logger.error("Database connection failed", exc_info=True)

Output:

{"timestamp": "2024-01-15T10:30:00.123Z", "level": "INFO", "message": "User logged in", "user_id": "123"}
{"timestamp": "2024-01-15T10:30:01.456Z", "level": "ERROR", "message": "Database connection failed", "exception": "..."}

Get Started

Who It’s For

  • Backend developers building APIs and microservices

  • Data engineers running pipelines and ETL jobs

  • DevOps teams managing infrastructure and monitoring

  • Anyone who’s tired of logging slowing down their Python apps


Documentation Sections

Documentation

Start Here:

Production Ready:

Reference:

Development:


If fapilog is useful to you, consider giving it a star on GitHub — it helps others discover the library.