Logly
Logly is a Rust-powered, Loguru-like logging library for Python that combines the familiarity of Python’s standard logging API with high-performance logging capabilities.
Install / Use
/learn @muhammad-fiaz/LoglyREADME
<a href="https://pypi.org/project/logly/"><img src="https://img.shields.io/pypi/v/logly" alt="PyPI"></a> <a href="https://pypistats.org/packages/logly"><img src="https://img.shields.io/pypi/dm/logly" alt="PyPI - Downloads"></a> <a href="https://muhammad-fiaz.github.io/logly/"><img src="https://img.shields.io/badge/docs-muhammad--fiaz.github.io-blue" alt="Documentation"></a> <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-%3E%3D3.10-brightgreen.svg" alt="Supported Python"></a> <a href="https://github.com/muhammad-fiaz/logly"><img src="https://img.shields.io/github/stars/muhammad-fiaz/logly" alt="GitHub stars"></a> <a href="https://github.com/muhammad-fiaz/logly/issues"><img src="https://img.shields.io/github/issues/muhammad-fiaz/logly" alt="GitHub issues"></a> <a href="https://github.com/muhammad-fiaz/logly/pulls"><img src="https://img.shields.io/github/issues-pr/muhammad-fiaz/logly" alt="GitHub pull requests"></a> <a href="https://github.com/muhammad-fiaz/logly"><img src="https://img.shields.io/github/last-commit/muhammad-fiaz/logly" alt="GitHub last commit"></a> <a href="https://github.com/muhammad-fiaz/logly/releases"><img src="https://img.shields.io/github/v/release/muhammad-fiaz/logly" alt="GitHub release"></a> <a href="https://codecov.io/gh/muhammad-fiaz/logly"><img src="https://codecov.io/gh/muhammad-fiaz/logly/graph/badge.svg?token=1G3MU8SDX1" alt="codecov"></a> <a href="https://github.com/muhammad-fiaz/logly"><img src="https://img.shields.io/github/license/muhammad-fiaz/logly" alt="License"></a> <a href="https://github.com/muhammad-fiaz/logly/actions/workflows/docs.yml"><img src="https://github.com/muhammad-fiaz/logly/actions/workflows/docs.yml/badge.svg" alt="Deploy Documentation"></a> <a href="https://github.com/muhammad-fiaz/logly/actions/workflows/python_publish.yaml"> <img src="https://github.com/muhammad-fiaz/logly/actions/workflows/python_publish.yaml/badge.svg?event=release" alt="Publish Python distributions" /> </a> <a href="https://github.com/muhammad-fiaz/logly/actions/workflows/testing.yml"><img src="https://github.com/muhammad-fiaz/logly/actions/workflows/testing.yml/badge.svg" alt="Testing"></a> <a href="https://github.com/muhammad-fiaz/logly/actions/workflows/github-code-scanning/codeql"><img src="https://github.com/muhammad-fiaz/logly/actions/workflows/github-code-scanning/codeql/badge.svg" alt="CodeQL"></a> <a href="https://github.com/muhammad-fiaz/logly/actions/workflows/dependabot/dependabot-updates"><img src="https://github.com/muhammad-fiaz/logly/actions/workflows/dependabot/dependabot-updates/badge.svg" alt="Dependabot Updates"></a> <a href="https://github.com/muhammad-fiaz/logly/actions/workflows/python-package.yaml"><img src="https://github.com/muhammad-fiaz/logly/actions/workflows/python-package.yaml/badge.svg" alt="Run Tests"></a>
<p><em>Rust-powered, Loguru-like logging for Python.</em></p>📚 Documentation | API Reference | Quick Start
</div><details> <summary>📋 Table of Contents</summary>
- Overview
- Installation
- Platform Support
- Quick Start
- Advanced Features
- Testing & Quality
- Documentation
- Contributing
- Changelog
- Acknowledgements
- License
Overview
Logly is a high-performance logging library for Python, powered by Rust. It combines the familiar Loguru-like API with the performance and safety guarantees of Rust.
Built with a modular Rust backend using PyO3/Maturin, Logly provides fast logging while maintaining memory safety and thread safety through Rust's ownership system.
If you like Logly, please give it a star ⭐ on GitHub! It really helps!
<details> <summary>🎯 Why Logly?</summary>⚠️ Active Development: Logly is a newer project and actively developed. Performance continues to improve with each release. also if you find a bug or a missing feature, please report it on GitHub. and Logly is not Production Ready yet :)
Logly offers a comprehensive set of logging features designed for modern Python applications:
🚀 Core Features
- Rust-Powered Backend: High-performance logging engine built with Rust, providing exceptional speed and memory efficiency
- Memory Safety: Zero-cost abstractions with Rust's ownership system prevent data races and memory corruption
- Thread Safety: Lock-free operations with optimized synchronization for concurrent applications
- Zero-Configuration Setup: Start logging immediately with sensible defaults - no configuration required
📝 Logging Capabilities
- Multiple Log Levels: Support for TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, FAIL, and CRITICAL levels
- Structured Logging: Native JSON output with custom fields and metadata
- Context Binding: Attach persistent context to loggers for request tracking and correlation
- Exception Handling: Automatic exception logging with stack traces and context
🎯 Output Management
- Multi-Sink Support: Route logs to multiple destinations (console, files, custom handlers) simultaneously
- Per-Sink Filtering: Independent filtering and formatting for each output destination
- Auto-Sink Levels: Automatic file creation and management for different log levels
- Console Control: Fine-grained control over console output, colors, and timestamps per log level
🔧 File Management
- Smart Rotation: Time-based (daily/hourly/minutely) and size-based log rotation
- Compression: Built-in gzip and zstd compression for rotated log files
- Retention Policies: Configurable retention periods and file count limits
- Async Writing: Background thread writing for non-blocking file operations
🔍 Advanced Filtering
- Level-Based Filtering: Filter logs by minimum severity level (threshold-based)
- Module Filtering: Include/exclude logs from specific Python modules
- Function Filtering: Target logs from specific functions or methods
- Custom Filters: Implement custom filtering logic with callback functions
📞 Callbacks & Extensions
- Async Callbacks: Real-time log processing with background execution
- Custom Formatting: Flexible template-based formatting with custom fields
- Color Styling: Rich color support for console output and callback processing
- Extensibility: Plugin architecture for custom sinks and processors and more...
🎉 Recent Changes
NEW in v0.1.6:
- ✅ Python 3.14 Support (#83) - Full compatibility with Python 3.14's latest features
- ✅ Time Format Specifications (#79) - Custom time formatting with Loguru-style patterns (
{time:YYYY-MM-DD HH:mm:ss}) - ✅ Internal Debugging Mode - New
internal_debug=Trueparameter for troubleshooting and bug reports - ✅ Enhanced Documentation - Comprehensive Python 3.14 guide, template string examples, and improved API reference
Recent Fixes:
- ✅ Jupyter/Colab Support (#76) - Logs now display correctly in notebook environments
- ✅ File Retention (#77) - Retention now properly limits total log files with size_limit
🎯 Python 3.14 Users: Check out the Python 3.14 Support Guide to learn how to use new features like deferred annotations, UUID7, improved pathlib, and InterpreterPoolExecutor with Logly!
Installation
From PyPI (Recommended)
pip install logly
From Source (Development)
Requires: Python 3.10+, Rust 1.70+, Maturin
git clone https://github.com/muhammad-fiaz/logly.git
cd logly
pip install maturin
maturin develop # Development build
For detailed installation instructions, see the Installation Guide.
Platform Support
Logly supports Python 3.10+ and is available for multiple platforms. The minimum required version is 0.1.4+.
| Python Version | Windows | macOS | Linux | |----------------|---------|-------|-------| | 3.10 | ✅ | ✅ | ✅ | | 3.11 | ✅ | ✅ | ✅ | | 3.12 | ✅ | ✅ | ✅ | | 3.13 | ✅ | ✅ | ✅ | | 3.14 | ✅ | ✅ | ✅ |
Notes:
- Python 3.14 support added in v0.1.6+ with full compatibility for new features
- Pre-built wheels available for all platforms (view on PyPI)
- All major Linux distributions are supported
- Both Intel and Apple Silicon macOS are supporte
