{"name":"Loguru: Python Logging Made Simple and Enjoyable","description":"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.","github":"https://github.com/Delgan/loguru","url":"https://osrepos.com/repo/delgan-loguru","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/delgan-loguru","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/delgan-loguru.md","json":"https://osrepos.com/repo/delgan-loguru.json","topics":["python","logging","loguru","logger","development","utility","open-source"],"keywords":["python","logging","loguru","logger","development","utility","open-source"],"stars":null,"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.","content":"## Introduction\n\nLoguru 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.\n\n## Installation\n\nGetting started with Loguru is straightforward. You can install it using pip:\n\nbash\npip install loguru\n\n\n## Examples\n\nLoguru simplifies many common logging tasks with elegant solutions.\n\n### Basic Usage\n\nStart logging instantly without any configuration:\n\npython\nfrom loguru import logger\n\nlogger.debug(\"That's it, beautiful and simple logging!\")\n\n\n### File Logging with Rotation and Retention\n\nEasily log to files, with built-in support for rotation, retention, and compression:\n\npython\nlogger.add(\"file_1.log\", rotation=\"500 MB\")    # Automatically rotate too big file\nlogger.add(\"file_2.log\", rotation=\"1 week\")    # New file is created each day at noon\nlogger.add(\"file_X.log\", retention=\"10 days\")  # Cleanup after some time\nlogger.add(\"file_Y.log\", compression=\"zip\")    # Save some loved space\n\n\n### Pretty Logging with Colors\n\nLoguru automatically adds colors to your terminal output, enhancing readability. You can customize the style using markup tags:\n\npython\nimport sys\nlogger.add(sys.stdout, colorize=True, format=\"<green>{time}</green> <level>{message}</level>\")\nlogger.info(\"This message will be <level>colorful</level>!\")\n\n\n### Robust Exception Catching\n\nEnsure all exceptions are caught and logged, even in threads, using the `catch()` decorator or context manager:\n\npython\nfrom loguru import logger\n\n@logger.catch\ndef my_function(x, y, z):\n    # An error? It's caught anyway!\n    return 1 / (x + y + z)\n\nmy_function(1, 2, -3)\n\n\n## Why Use Loguru?\n\nLoguru stands out for several compelling reasons:\n\n*   **Simplicity**: Eliminates boilerplate code and complex configurations, making logging accessible from the start.\n*   **Rich Features**: Offers advanced functionalities like automatic file rotation, retention, compression, modern string formatting, and asynchronous logging.\n*   **Enhanced Debugging**: Provides fully descriptive exceptions with stack traces and variable values, significantly speeding up bug identification.\n*   **Developer Experience**: Features like colored output, customizable levels, and seamless integration with standard logging make the development process more pleasant.\n*   **Thread and Multiprocess Safety**: Ensures log integrity in complex applications.\n*   **Structured Logging**: Supports serialization to JSON and contextual binding for easier log analysis.\n\n## Links\n\n*   **GitHub Repository**: [https://github.com/Delgan/loguru](https://github.com/Delgan/loguru){target=\"_blank\"}\n*   **Official Documentation**: [https://loguru.readthedocs.io/en/stable/index.html](https://loguru.readthedocs.io/en/stable/index.html){target=\"_blank\"}\n*   **API Reference**: [https://loguru.readthedocs.io/en/stable/api/logger.html](https://loguru.readthedocs.io/en/stable/api/logger.html){target=\"_blank\"}","metrics":{"detailViews":1,"githubClicks":1},"dates":{"published":null,"modified":"2025-12-10T12:00:57.000Z"}}