High-performance Python logging — Rust-powered, stdlib-compatible API
Project description
LogXide
Several-fold faster than stdlib logging (roughly 5–11× on file logging, scenario- and machine-dependent), sink-verified. Powered by Rust.
Same stdlib API. Same getLogger. Same format strings. Just faster.
# Before # After
import logging from logxide import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('myapp')
logger.info('Hello, world!') # Same code, several-fold faster.
Installation
pip install logxide
# With Sentry integration
pip install logxide[sentry]
Performance
LogXide is performance-first: its native Rust handlers dispatch on the GIL-released fast path, formatting and writing without materializing a Python LogRecord. As of 0.2.0 the text-sink wrappers (FileHandler, StreamHandler, RotatingFileHandler) emit through that native Rust path by default; a handler only falls back to the Python path for a custom Formatter subclass, {/$-style format strings, or a handler-level Python filter.
Benchmarks
Two sink-verified benchmarks, both re-run this session on macOS M4 Max, release build, across Python 3.12.11 and 3.14.2. Sink-verified durable throughput means records the sink actually confirmed after flush(), not records merely enqueued. Numbers are machine-specific and rounded to ranges; baselines are noisy run-to-run (roughly ±40%), so treat the ranges as the signal, not any single figure. CPython 3.12 and 3.14 come out at parity once the test environments match, so the ranges below apply to both.
Benchmark A — native FileHandler vs stdlib. benchmark/perf_vs_stdlib.py, LogXide and stdlib each measured in isolation. FileHandler is synchronous, so these are durable (no async drops). Rounded speedup vs stdlib, comparable on Python 3.12 and 3.14:
| Scenario | Speedup vs stdlib |
|---|---|
| simple | ~7–9× |
| structured | ~7–9× |
%-args |
~5–6× |
Benchmark B — durable cross-library sink. benchmark/basic_handlers_benchmark.py, each library in its own subprocess, sink-verified 20,200 / 20,200. Rounded speedup vs stdlib, comparable across Python 3.12 and 3.14:
| Sink | Speedup vs stdlib |
|---|---|
| FILE | ~6–11× |
| ROTATING | ~8–14× |
| STREAM | ~5× (async, see note) |
STREAM is asynchronous. It reaches ~5× when its queue fully drains, but under a sustained max-rate burst the bounded queue can drop records (one loaded run delivered ~14,420 / 20,200; an idle machine delivered 20,200 / 20,200). Treat STREAM as fast best-effort delivery: call
flush()and checkget_metrics()to confirm what landed, rather than as a guaranteed durable multiplier.
Async HTTP delivery is accounted honestly on both versions: http_block lands 20,000 / 20,000 (durable), while http_drop_newest delivers ~260 / 20,000 and drops the rest, with emitted == sink_acknowledged + queue_dropped + delivery_failed holding throughout.
A prior draft reported a "Python 3.14 regression" (roughly half the file-path speedup on 3.14). That was a measurement artifact, not a real regression: the 3.14 test environment had
sentry-sdkinstalled while the 3.12 one did not, and importing it pulled in a formatter-lessNullHandlerthat forced process-global caller-frame collection on every log (a ~20% tax that only hit the 3.14 runs). This is fixed in 0.2.1; environment-matched, the two versions are at parity.
For full per-handler p50/p99 latency, cross-library detail, and async accounting, see docs/benchmarks.md.
Works With
LogXide intercepts stdlib logging — most libraries work without changes.
| Framework / Library | Status | Notes |
|---|---|---|
| Flask | ✅ | app.logger automatically intercepted |
| Django | ✅ | LOGGING dictConfig supported |
| FastAPI / Uvicorn | ✅ | All uvicorn loggers intercepted |
| SQLAlchemy | ✅ | SQL query logging via echo=True |
| requests / httpx | ✅ | HTTP connection logs captured |
| boto3 / botocore | ✅ | AWS SDK logs captured |
| Sentry | ✅ | Native integration — auto-detects an already-configured SDK |
| Celery | ⚠️ | Requires setup_logging signal (guide) |
| pytest | ⚠️ | Use caplog_logxide instead of caplog |
Full compatibility guide for 20+ libraries →
Built-in Sentry Integration
No extra handlers. No configuration. Just works.
import sentry_sdk
sentry_sdk.init(dsn="your-dsn")
from logxide import logging
logger = logging.getLogger(__name__)
logger.error("This is automatically sent to Sentry")
- Auto-detects a configured Sentry SDK (a call to
sentry_sdk.init()must have run first) - WARNING+ sent as events, INFO as breadcrumbs
- Full stack traces and custom context
An installed-but-unconfigured Sentry SDK does not attach a handler, and (as of 0.2.1) importing it no longer forces process-global caller-frame collection onto unrelated handlers.
Native OpenTelemetry Support
Ship logs to any OTLP-compatible backend with zero dependencies:
from logxide import OTLPHandler
handler = OTLPHandler(
url="http://localhost:4318/v1/logs",
service_name="my-service"
)
Quick Start
from logxide import logging
# Basic setup — same API as stdlib
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger('myapp')
logger.info('Hello from LogXide!')
logger.warning('This works exactly like stdlib logging')
Custom fields with extra
logger.info("User logged in", extra={
"user_id": 12345,
"ip": "192.168.1.1",
"metadata": {"browser": "Chrome", "version": 120}
})
HTTP log shipping
from logxide import HTTPHandler
handler = HTTPHandler(
url="https://logs.example.com",
global_context={"app": "myapp", "env": "production"},
transform_callback=lambda records: {
"logs": [{"msg": r["msg"], "level": r["levelname"]} for r in records]
}
)
What's Different from stdlib
LogXide reimplements Python's logging in Rust for speed. The API is the same, but some advanced stdlib patterns aren't supported:
| Feature | Status |
|---|---|
getLogger, info, debug, warning, error, critical |
✅ Same API |
basicConfig, format strings, levels, filters |
✅ Same API |
FileHandler, StreamHandler, RotatingFileHandler |
✅ Rust-native |
HTTPHandler, OTLPHandler |
✅ Rust-native, high throughput |
Custom Python handlers via addHandler() |
⚠️ Accepted; runs once on the Python side (no fast-path GIL release) |
Subclassing LogRecord or Logger |
❌ Rust types, not subclassable |
pytest caplog fixture |
⚠️ Use caplog_logxide instead |
Instead of subclassing LogRecord, use extra={} for custom fields, global_context for metadata, or transform_callback for output transformation.
Compatibility
- Python: 3.12, 3.13, 3.14 (fully tested and supported)
- Python 3.15: Not yet supported — blocked by an upstream
pyo3↔ Python 3.15-alpha ABI mismatch (the compiled extension references a CPython internal symbol_PyType_FromSlotsthat current 3.15 alpha builds do not export). Tracking for re-enablement oncepyo3ships a 3.15-compatible release. - Platforms: macOS, Linux, Windows
- Dependencies: None (Rust compiled into native extension)
Documentation
- Usage Guide — Complete API guide
- Integration Guide — Flask, Django, FastAPI
- Third-Party Compatibility — 20+ libraries
- Performance Benchmarks — Detailed analysis
- Architecture — Technical design
- API Reference — Full reference
Contributing
git clone https://github.com/Indosaram/logxide
cd logxide
pip install maturin
maturin develop
pytest tests/
See development guide for details.
License
MIT License — see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logxide-0.2.1.tar.gz.
File metadata
- Download URL: logxide-0.2.1.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d441710360560b99c096999122c32b888f6bebcf6d309a3c9126e011001edba
|
|
| MD5 |
94fd46c0af37601957787fc2ab6a8d40
|
|
| BLAKE2b-256 |
1d22fbb61d45da25ac23b9b55710d293cbfb7f2f54da9695efadbce8fe1de763
|
File details
Details for the file logxide-0.2.1-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: logxide-0.2.1-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b00c182e831a2b8f4bd661af31dcc8f424c542d8aeae15cbd01159704f772d9c
|
|
| MD5 |
0a30121c53448051f72d93c303a7566a
|
|
| BLAKE2b-256 |
a98b678021e8c8f28f7d31ae0d81cedbd2c82bbd23fd091c5826de7b4a318d02
|
File details
Details for the file logxide-0.2.1-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: logxide-0.2.1-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c95b5f20dbddb2d28e005b0d1786f7e26c635f431afc096688946d359c1ace8
|
|
| MD5 |
b1bf4be7781ee71fa2c91921e8a558e0
|
|
| BLAKE2b-256 |
e7690892c6225075c7bdba92b45b3c714283b8e8935bd7bcd238a1b2c87f0cf8
|
File details
Details for the file logxide-0.2.1-cp314-cp314-macosx_10_12_x86_64.whl.
File metadata
- Download URL: logxide-0.2.1-cp314-cp314-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.14, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b7c3a1c9f90b24b4578273d11a6c006159edfcff61e837b10e65ce895e10008
|
|
| MD5 |
cd098b79e70367744042209a574ef1f0
|
|
| BLAKE2b-256 |
b24bae0f488076d82c709062e114ff2e8d307bd1870258ac8543f705ef36d139
|
File details
Details for the file logxide-0.2.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: logxide-0.2.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91b875213c81f55764cbb43ab4211d446cad4e705fab5037d846f9141c73f841
|
|
| MD5 |
a5b2a4850d89e6b910273ddbaf0b174f
|
|
| BLAKE2b-256 |
6a783bcabe69042353eedad28cc29d6a1dec3bc559119935a7bc7aece56b2ff2
|
File details
Details for the file logxide-0.2.1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: logxide-0.2.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ec2a8e7e2b1dd03f005fa0493e0a34e11304753e70fd8b73b742c1bfc98f34b
|
|
| MD5 |
9301b8c72bf43fadb6c89bf585a140af
|
|
| BLAKE2b-256 |
71bbe88f37acad4b4dd38858e2dbb1971339de8639413b12871b9514df7b4636
|
File details
Details for the file logxide-0.2.1-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: logxide-0.2.1-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e3bc7b9f608e85e2716f43171d31e01eafee2895d5088c0f36f4dcbd2dbd346
|
|
| MD5 |
42f8a47889edffa931c7fe8a2f053b75
|
|
| BLAKE2b-256 |
ca22a1ec5f2b516ad8962b9f28d081bbb4199a6373116927d8f5628050743460
|
File details
Details for the file logxide-0.2.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: logxide-0.2.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed81aa03bb5709e70c2984ecc96777e9eb5a781a132a77f79c4e23ec61e4b3d2
|
|
| MD5 |
e8e3937afb91cb777cf5338a60cdb924
|
|
| BLAKE2b-256 |
b866312e908f772879e3afcfbcb11bf50dd35509d3a4d018189f9918d9f19836
|
File details
Details for the file logxide-0.2.1-cp312-cp312-win32.whl.
File metadata
- Download URL: logxide-0.2.1-cp312-cp312-win32.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.12, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3367c5c000730ead5bba4ac16d50ab127a7ca9766e3af81a3ef95cdf7f0d95c5
|
|
| MD5 |
5020582997898a896d9a3894ea2f544c
|
|
| BLAKE2b-256 |
f5f77fcb36adca3998960272cba196a0253076f3863ebda36130eab8c5af3f81
|
File details
Details for the file logxide-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: logxide-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c2521db36819c46c068696371fbd7a249794b6a8617172fd186f12b62e123cd
|
|
| MD5 |
717ec70f4524fca9d01e064efdbaef79
|
|
| BLAKE2b-256 |
e98b6d6a22041b273b39b8320a088b5e281deaced4b1ead0011bb9a99229f574
|
File details
Details for the file logxide-0.2.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl.
File metadata
- Download URL: logxide-0.2.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7998a5791b2e72640813719eb752dcf37dd008b8c0a799117cbec1016a2c88d8
|
|
| MD5 |
4034d4da6112c97d234017351c508dd0
|
|
| BLAKE2b-256 |
9f647dc64acd89b58b302eb6a862a3ccc99999307785ef2b3d300511dea7e03d
|
File details
Details for the file logxide-0.2.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.
File metadata
- Download URL: logxide-0.2.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bad417c738627c909f21db4ec1d3f1b8e08588bfab6296c8fea772c44f9ce08
|
|
| MD5 |
b2cabfa71b4cdc46eb4ac759904ea912
|
|
| BLAKE2b-256 |
6fd60d2e3f59e9eeac03beb6ed7d73eac5e3fa6917b193d13a43da41c6bcd38f
|
File details
Details for the file logxide-0.2.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: logxide-0.2.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2827968d78be563b4b31e02961adccec938654326b528fa1f2fed7506a814b14
|
|
| MD5 |
e6a3adb0df14a70e06ba1939d259d0eb
|
|
| BLAKE2b-256 |
6a6ed6b2a30d1e72023043910d32dcc8609a8e5d0c8876d0c2508eee577b26ba
|
File details
Details for the file logxide-0.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: logxide-0.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7b00b9667c9026d7234d2f8840dc3c88c38ef7e297a234451a2c4124c100c5f
|
|
| MD5 |
e6531bcfc024a9938ac3b544c2c33702
|
|
| BLAKE2b-256 |
796afbd27901965cd8f6490e14b3101f8bf533b2e35907d367f144b8bd489101
|
File details
Details for the file logxide-0.2.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl.
File metadata
- Download URL: logxide-0.2.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.12, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
302dce7e735f7c0f04b71f9d752994da678584f6d68ceaf4871b5d1d91506c74
|
|
| MD5 |
818b9483196f4820027e39ee51b305bd
|
|
| BLAKE2b-256 |
216dea5e821ff7b44f3e4fbe6e2cb1fed1ad83f6621423e3463c643f7bc031cb
|
File details
Details for the file logxide-0.2.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: logxide-0.2.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f11ea12b271aedd85787dc885215602aea6fbbe56e5e67061e95c536e591b49e
|
|
| MD5 |
3d157572eaf99d3fd52f577421c06ec5
|
|
| BLAKE2b-256 |
218ba5c966899735563eb58c8add220ef2582b2a9d9bbd1a1f3187abf59d0629
|
File details
Details for the file logxide-0.2.1-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: logxide-0.2.1-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edee2093c7b97d023a85271ce8d0984b997a70d7e8b806d778eab9144396bf2d
|
|
| MD5 |
2bd168fbc8e1d53a68a155fd1dbe8657
|
|
| BLAKE2b-256 |
a4487ae5d4af74ce63c95b3c66e57c75e5cb0e6ad866e4d6fdc59b19c2109418
|