About this project

Loguru is a Python logging library designed to eliminate the complexity of traditional logging setups. It provides a single pre-configured logger accessible via `from loguru import logger`, requiring no handlers, formatters, or filters to begin. Logging messages can be written immediately using methods like `logger.debug()` or `logger.info()`, with output directed to stderr by default. Key features include: easy file logging with automatic rotation (by size, time, or age), retention policies, and compression; modern brace-style string formatting compatible with `str.format()`; automatic colorization in terminals; support for asynchronous, thread-safe, and multiprocess-safe logging via `enqueue=True`; and full exception traceback display including variable values. It supports structured logging through JSON serialization and contextual binding (`bind()`, `contextualize()`, `patch()`). Users can customize levels, add lazy evaluation for expensive functions, and integrate with standard Python logging via compatibility layers. Environment variables allow personalizing defaults like format or color. Loguru also includes a parser for regex-based log extraction and integrates with notification tools like Apprise for alerts on errors. Designed for both scripts and libraries, it allows disabling/enabling logging per module namespace. While previously claiming 10x speed over built-in logging, this claim is now deprecated. The library emphasizes usability, configurability, and debugging power without sacrificing performance or flexibility.