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.

OpenSandbox: A Secure and Extensible Sandbox Runtime for AI Agents

OpenSandbox: A Secure and Extensible Sandbox Runtime for AI Agents

August 12, 2026

OpenSandbox is a powerful, general-purpose sandbox platform designed for AI applications. It provides secure, fast, and extensible runtime environments, supporting multi-language SDKs and Docker/Kubernetes deployments. This project is ideal for developing and evaluating AI agents in isolated, controlled settings.

aiai-agentai-infra
FastMCP: The Pythonic Framework for Model Context Protocol Applications

FastMCP: The Pythonic Framework for Model Context Protocol Applications

August 11, 2026

FastMCP is a robust, Pythonic framework developed by PrefectHQ, designed to simplify the creation of Model Context Protocol (MCP) servers and clients. It provides a comprehensive application framework for connecting Large Language Models (LLMs) to tools and data, handling complexities like schema generation, validation, and protocol lifecycle. As the standard framework for MCP, FastMCP empowers developers to build powerful LLM-integrated applications efficiently.

fastmcpmcpmodel-context-protocol
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

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 ❤️