Loguru: Python Logging Made Simple and Enjoyable
This repository profile is provided by osrepos.com, an open source repository discovery platform.
Summary
Loguru is a powerful and user-friendly Python library designed to simplify logging. It aims to make logging an enjoyable and straightforward process, eliminating the need for complex configurations. With Loguru, developers can implement robust logging solutions with minimal boilerplate, enhancing debugging and application monitoring.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
Loguru is a Python library that revolutionizes the way developers approach logging. It addresses the common pain points of traditional logging setups, offering a solution that is both simple to use and incredibly powerful. Designed to be ready out-of-the-box, Loguru encourages developers to integrate logging from the very beginning of their projects, making debugging and monitoring significantly easier. It provides a unified, intuitive API, replacing complex configurations with a single logger object and an add() function.
Installation
Getting started with Loguru is straightforward. You can install it using pip:
pip install loguru
Examples
Loguru simplifies many common logging tasks with elegant solutions.
Basic Usage
Start logging instantly without any configuration:
from loguru import logger
logger.debug("That's it, beautiful and simple logging!")
File Logging with Rotation and Retention
Easily log to files, with built-in support for rotation, retention, and compression:
logger.add("file_1.log", rotation="500 MB") # Automatically rotate too big file
logger.add("file_2.log", rotation="1 week") # New file is created each day at noon
logger.add("file_X.log", retention="10 days") # Cleanup after some time
logger.add("file_Y.log", compression="zip") # Save some loved space
Pretty Logging with Colors
Loguru automatically adds colors to your terminal output, enhancing readability. You can customize the style using markup tags:
import sys
logger.add(sys.stdout, colorize=True, format="<green>{time}</green> <level>{message}</level>")
logger.info("This message will be <level>colorful</level>!")
Robust Exception Catching
Ensure all exceptions are caught and logged, even in threads, using the catch() decorator or context manager:
from loguru import logger
@logger.catch
def my_function(x, y, z):
# An error? It's caught anyway!
return 1 / (x + y + z)
my_function(1, 2, -3)
Why Use Loguru?
Loguru stands out for several compelling reasons:
- Simplicity: Eliminates boilerplate code and complex configurations, making logging accessible from the start.
- Rich Features: Offers advanced functionalities like automatic file rotation, retention, compression, modern string formatting, and asynchronous logging.
- Enhanced Debugging: Provides fully descriptive exceptions with stack traces and variable values, significantly speeding up bug identification.
- Developer Experience: Features like colored output, customizable levels, and seamless integration with standard logging make the development process more pleasant.
- Thread and Multiprocess Safety: Ensures log integrity in complex applications.
- Structured Logging: Supports serialization to JSON and contextual binding for easier log analysis.
Links
- GitHub Repository: https://github.com/Delgan/loguru
- Official Documentation: https://loguru.readthedocs.io/en/stable/index.html
- API Reference: https://loguru.readthedocs.io/en/stable/api/logger.html
Related repositories
Similar repositories that may be relevant next.
OpenMontage: The First Open-Source, Agentic Video Production System
June 29, 2026
OpenMontage is the world's first open-source, agentic video production system, designed to transform your AI coding assistant into a full video production studio. It features 12 pipelines, 52 tools, and over 500 agent skills, enabling end-to-end video creation from a simple prompt. This powerful tool handles research, scripting, asset generation, editing, and final composition, including the unique ability to produce real video from stock footage.

MarkLLM: An Open-Source Toolkit for LLM Watermarking
June 23, 2026
MarkLLM is an open-source toolkit designed to simplify the research and application of watermarking technologies for large language models (LLMs). It offers a unified framework for implementing various watermarking algorithms, alongside robust visualization and comprehensive evaluation tools. This toolkit helps researchers and the broader community understand and assess the authenticity and origin of machine-generated text.

Agent-Reach: Empower Your AI Agents with Internet Access, Zero API Fees
June 21, 2026
Agent-Reach is a powerful GitHub repository that equips AI agents with the ability to access and search the entire internet, including platforms like Twitter, Reddit, YouTube, and Bilibili. It provides a streamlined CLI experience, eliminating the need for complex API configurations and associated fees. This project ensures your AI agent can "see" and interact with web content effortlessly.
REAL Video Enhancer: AI-Powered Video Interpolation, Upscaling, and Denoising
June 19, 2026
REAL Video Enhancer is a powerful open-source application designed to enhance video quality across Linux, Windows, and macOS. It leverages AI models for advanced video processing tasks such as frame interpolation, upscaling, decompression, and denoising. This tool provides a modern alternative to older software, making high-quality video enhancement accessible to a wider audience.
Source repository
Open the original repository on GitHub.