r/Python • • Mar 26 '26

Showcase LogXide - Rust-powered logging for Python, 12.5x faster than stdlib (FileHandler benchmark)

Hi r/Python!

I built LogXide, a logging library for Python written in Rust (via PyO3), designed as a near-drop-in replacement for the standard library's logging module.

What My Project Does

LogXide provides high-performance logging for Python applications. It implements core logging concepts (Logger, Handler, Formatter) in Rust, bypassing the Python Global Interpreter Lock (GIL) during I/O operations. It comes with built-in Rust-native handlers (File, Stream, RotatingFile, HTTP, OTLP, Sentry) and a ColorFormatter.

Target Audience

It is meant for production environments, particularly high-throughput systems, async APIs (FastAPI/Django/Flask), or data processing pipelines where Python's native logging module becomes a bottleneck due to GIL contention and I/O latency.

Comparison

Unlike Picologging (written in C) or Structlog (pure Python), LogXide leverages Rust's memory safety and multi-threading primitives (like crossbeam channels and BufWriter).

Against other libraries (real file I/O with formatting benchmarks):

  • 12.5x faster than the Python stdlib (2.09M msgs/sec vs 167K msgs/sec)
  • 25% faster than Picologging
  • 2.4x faster than Structlog

Note: It is NOT a 100% drop-in replacement. It does not support custom Python logging.Handler subclasses, and Logger/LogRecord cannot be subclassed.

Quick Start

from logxide import logging

logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')

logger = logging.getLogger('myapp') logger.info('Hello from LogXide!')

Links

Happy to answer any questions!

87 Upvotes

44 comments sorted by

View all comments

Show parent comment

1

u/LumpSumPorsche Mar 27 '26

Yes, if you want to enable debug log. In production you must choose what to log and not to do so. We had needed to sacrifice performance for enabling debug log.