Skip to content

LoglyRust-Powered Logging for Python

A Rust-powered, high-performance logging library for Python.

Logly

Quick Example ​

python
from logly import logger

# Add sinks with per-sink configuration
logger.add("app.log", level="DEBUG", rotation="daily", retention="30 days", compression="gzip")
logger.add("errors.log", level="ERROR", rotation="daily", retention="90 days")
logger.add("stdout", level="INFO", colorize=True)

# Log at all levels
logger.trace("Detailed trace")
logger.debug("Debug info")
logger.info("Application started")
logger.notice("Notice message")
logger.success("Operation completed!")
logger.warning("Warning message")
logger.error("Error occurred")
logger.fail("Operation failed")
logger.critical("Critical system error!")
logger.fatal("Fatal system failure!")

# Bind context
app_logger = logger.bind(user_id="12345", request_id="abc-789")
app_logger.info("User logged in")

# Exception handling
with logger.catch():
    risky_operation()

logger.complete()

Installation ​

bash
pip install logly
bash
uv add logly
bash
git clone https://github.com/muhammad-fiaz/logly.git
cd logly
uv sync
uv run maturin develop

Why Logly? ​

FeatureLoglystdlib logging
Rust-native engine✅❌
10 built-in log levels✅❌
Custom levels✅Manual
Multiple sinks✅✅
File rotation✅Handler dependent
Retention policies✅Handler dependent
Compression✅Handler dependent
JSON serialization✅Formatter dependent
Context binding✅Adapter based
Record patching✅❌
Exception catching✅❌
Background workers✅QueueHandler
FastAPI integration✅❌
Django integration✅❌
Rich console✅❌
Custom colors (ANSI)✅Manual
Type-safe config✅❌
Zero unsafe Rust✅N/A

Active Development

Logly is currently under active development and stabilizing. Due to this, performance benchmarks are not yet available. If you encounter any issues, please feel free to report them.

Released under the MIT License.