Loguru: Python Logging Made Simple and Enjoyable

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Loguru: Python Logging Made Simple and Enjoyable

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

Analyzed by OSRepos on December 10, 2025

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

Related repositories

Similar repositories that may be relevant next.

nanobot: An Ultra-Lightweight, Self-Hosted Personal AI Agent Framework

nanobot: An Ultra-Lightweight, Self-Hosted Personal AI Agent Framework

August 9, 2026

nanobot is an ultra-lightweight, open-source, self-hosted personal AI agent framework built in Python. It offers a WebUI, tools, memory, multi-agent workflows, and automation capabilities, making it a versatile solution for personal AI tasks. Users can deploy it across various platforms, including chat apps, for seamless integration.

ai-agentagent-frameworkpython
ReMe: An Advanced Memory Management Kit for AI Agents

ReMe: An Advanced Memory Management Kit for AI Agents

August 7, 2026

ReMe is an innovative, local-first memory layer designed for AI agents, transforming conversations and resources into file-based long-term memory. It continuously indexes, links, and consolidates this information, enabling advanced recall and supporting the development of self-evolving agents. This kit helps agents remember and refine their experiences effectively.

agentai-agentsmemory
code-review-graph: AI-Powered Code Intelligence for Smarter Reviews

code-review-graph: AI-Powered Code Intelligence for Smarter Reviews

August 6, 2026

code-review-graph is a local-first code intelligence graph that optimizes AI coding tools by building a persistent map of your codebase. It significantly reduces context for AI reviews and large-repo workflows, ensuring AI assistants read only the most relevant code. This leads to more efficient and cost-effective code analysis.

ai-codingcode-reviewknowledge-graph
Nikola: A Powerful Static Website and Blog Generator

Nikola: A Powerful Static Website and Blog Generator

August 6, 2026

Nikola is an open-source static website and blog generator written in Python. It transforms content into a deployable website, offering a secure and resource-efficient alternative to dynamic sites. With features like theming, fast builds, and multilingual support, Nikola is a versatile tool for web development.

pythonstatic-sitestatic-site-generator

Source repository

Open the original repository on GitHub.

12 counted GitHub visits

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️