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 levelsManual
Multiple sinks
File rotationHandler dependent
Retention policiesHandler dependent
CompressionHandler dependent
JSON serializationFormatter dependent
Context bindingAdapter based
Record patching
Exception catching
Background workersQueueHandler
FastAPI integration
Django integration
Rich console
Custom colors (ANSI)Manual
Type-safe config
Zero unsafe RustN/A

Acknowledgment

The API design of this project is inspired by Loguru by Delgan. Logly includes every feature you would expect from a mature logging library, plus additional capabilities like Rust-powered performance, network sinks (HTTP, TCP, UDP, Syslog), scheduled rotation, ANSI color themes, source context display, and 30+ framework integrations. We are grateful for the design inspiration.

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.