Delgan

loguru: Simplify Logging in Python

Loguru is a Python logging library designed to make useful logging easy to add without the standard logging setup boilerplate. It suits scripts and applications that need configurable outputs, structured context, and clearer exception traces.

View on GitHub Compare
Stars
24.1k
Forks
824
Stars, last 30 days
+8

Our take

Health score

46/100

How it is scored
Activity
38
Community
55
Issues
52
Pull requests
37

+8 stars in the last 30 days

  • Slower to merge pull requests than 89% of the projects we track

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

24,157

Forks

835

Change since Nov 14, 2026: +1 stars·0 forks

Overview

Loguru is a Python logging library built around a ready-to-use logger, so developers can start logging without first configuring handlers, formatters, and filters. It addresses the friction of setting up the standard logging module while retaining options to route and format messages for different needs.

It is aimed at Python developers building scripts, applications, or libraries who want convenient logging with features such as file rotation, contextual fields, and detailed exception output. Its API also supports integration with Python's standard logging handlers and messages.

Key Features

  • Provides a preconfigured logger that writes to stderr by default.
  • Adds sinks for files, streams, functions, coroutine functions, or standard logging handlers through one API.
  • Supports file rotation, retention, and compression.
  • Offers brace-style message formatting, colorized output, and customizable levels.
  • Adds contextual fields and optional JSON serialization for structured logs.
  • Captures exceptions with expanded stack traces and variable values, when enabled.
  • Supports thread-safe sinks and an enqueue option for multiprocess-safe logging.
  • Provides standard logging interoperability and a parser for extracting data from logs.

Use Cases

  • Add useful diagnostics to a small script without building a logging configuration first.
  • Write application logs to managed files with rotation or retention policies.
  • Attach request, user, or task context to messages when investigating production behavior.
  • Capture detailed exception information while debugging failures in application code.
  • Adopt Loguru in an existing project that also uses Python's standard logging module.

Getting Started

Install with pip:

pip install loguru

Then import the logger with from loguru import logger. See the README and documentation for configuration and usage details.

Considerations

  • Loguru's sinks are thread-safe by default, but not multiprocess-safe by default. Use enqueue=True when log integrity across processes is needed.
  • Exception diagnostics can include local variable values. The README warns that diagnose=True is enabled by default and may expose sensitive data in production.
  • The library provides its own logger interface. Projects with existing logging setups should review the documented integration patterns before changing their logging configuration.
  • The README describes compatibility with Python 3.5+ and PyPy; check the current documentation for applicable version details.

Found this useful?

Share it with someone who would like loguru.