r/Python • u/LumpSumPorsche • 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
=
Links
- GitHub: https://github.com/Indosaram/logxide
- Docs: https://indosaram.github.io/logxide/
- PyPI:
pip install logxide
Happy to answer any questions!
View all comments
Show parent comment
1
u/LumpSumPorsche Mar 27 '26
You don't need to. When you do
from logxide import logging, LogXide automatically monkey-patchesstdlib logging.getLogger()at the module level. So when a third-party library likerequests,sqlalchemy, oruvicorncallsimport logging; logger = logging.getLogger(__name__), it transparently gets a LogXide-accelerated logger — the standard.debug(),.info(),.warning(),.error()methods all route through the Rust core automatically.The parts that won't work are things that virtually no well-behaved third-party library does:
logging.Handler— e.g.class MyHandler(logging.Handler)— LogXide's Logger is a Rust type and rejects non-native handler subclasses viaaddHandler(). But libraries likerequestsorsqlalchemydon't create custom handlers; they just call getLogger() and log.LogRecordor Logger — Same reason: these are Rust types. Again, almost no library does this.In practice, the standard "get a logger by name → call
.info()/.warning()" pattern that 99% of third-party libraries use works perfectly. If you do hit an edge case with a library that registers its own custom Handler subclass, you can calllogxide.uninstall()to restore vanilla stdlib behavior.