talira

Python logging made simple: one logger, no boilerplate

open sourceMITfree

Loguru is an open source Python logging library by Delgan that works out of the box with from loguru import logger, replacing handlers, formatters and filters with one add() function. It rotates, retains and compresses log files, formats with braces, colours output, catches exceptions with fully descriptive tracebacks, logs structured data, and is thread-safe, multiprocess-safe and asynchronous. It's compatible with the standard logging module.

Problems it solves

  • set up logging in a Python script without configuring handlers and formatters
  • rotate and compress my Python app's log files automatically
  • get readable tracebacks with variable values when my Python code crashes

Features

  • ready to use without configuration
  • one add() function instead of handlers, formatters and filters
  • file logging with rotation, retention and compression
  • brace-style formatting and coloured output
  • exception catching with fully descriptive tracebacks
  • structured logging, lazy evaluation and custom levels
  • thread-safe, multiprocess-safe and asynchronous sinks
  • compatible with the standard logging module