Skip to main content

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.

Familiar stdlib-style API — for common patterns, change one import and getLogger, format strings, and handlers work as expected. It's a near-drop-in, not a strict one: some advanced stdlib behaviors differ (flush now drains/waits, LogRecord/Logger can't be subclassed, custom Formatter subclasses fall back to a slower path). See compatibility.

# Before                              # After
import logging                        from logxide import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('myapp')
logger.info('Hello, world!')          # Common patterns: same code, several-fold faster.

PyPI Python License: MIT CI

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 check get_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-sdk installed while the 3.12 one did not, and importing it pulled in a formatter-less NullHandler that 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_FromSlots that current 3.15 alpha builds do not export). Tracking for re-enablement once pyo3 ships a 3.15-compatible release.
  • Platforms: macOS, Linux, Windows
  • Dependencies: None (Rust compiled into native extension)

Documentation

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logxide-0.2.2.tar.gz (1.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

logxide-0.2.2-cp314-cp314-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.14Windows x86-64

logxide-0.2.2-cp314-cp314-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

logxide-0.2.2-cp314-cp314-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

logxide-0.2.2-cp313-cp313-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.13Windows x86-64

logxide-0.2.2-cp313-cp313-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

logxide-0.2.2-cp313-cp313-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

logxide-0.2.2-cp312-cp312-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.12Windows x86-64

logxide-0.2.2-cp312-cp312-win32.whl (1.0 MB view details)

Uploaded CPython 3.12Windows x86

logxide-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

logxide-0.2.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ s390x

logxide-0.2.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ppc64le

logxide-0.2.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARMv7l

logxide-0.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

logxide-0.2.2-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.12+ i686

logxide-0.2.2-cp312-cp312-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

logxide-0.2.2-cp312-cp312-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

Details for the file logxide-0.2.2.tar.gz.

File metadata

  • Download URL: logxide-0.2.2.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for logxide-0.2.2.tar.gz
Algorithm Hash digest
SHA256 63aeabb9465fa202720c2ec414c644dc6f9018e700d5b424c5941f78e8e8de67
MD5 38f18d26b8ceb153276292923d82eb9d
BLAKE2b-256 6343ac984fa7fdc5d78a589bb295bb8f2263c247a8432b3e475bd12e84d47b58

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: logxide-0.2.2-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

Hashes for logxide-0.2.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 46ee742b7bfdbf178bff32884a41c48dd6deb3edd559061172cd8189931963a4
MD5 5c2a874f28512cdb9398a0dbb88010dc
BLAKE2b-256 2d2070b9cef37939e6c3007937a85bb5ba6255a83ae234c496fc50b5930ef3f7

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8340a8da2cd0899ec1dc445ed1472f39ccff71055c1f7827d02c27b80cfb221b
MD5 36c4b4ef11c3437ec821e47c9e9ab88e
BLAKE2b-256 9b30b071ef4f002ee1d6e093baea1b836004b9488297823476998d1d5c54c4e4

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cf101c661d8b96742635010573737e876549c5d97e89758d00c82b3fa074bbb2
MD5 21aabbe6ab1f037ef5d1ea4810bb6491
BLAKE2b-256 b3569cf3745430e4b26787c089ca343b96844a8dbc674cb1fd1e53e73c4babc7

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: logxide-0.2.2-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

Hashes for logxide-0.2.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3c0d1ec2a719629a8ee3d2ce4bda91edecc83686978e474ab73f8b960c3dbfc4
MD5 9220612a39eb1530c75d44d2d0192ae9
BLAKE2b-256 bf82f7b8156e623d4683524454d11eded4d55777fa6745b185e9f335691b6cbb

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1fb3e3610ae57aed66cab3cdf59c9b7a178f41842cfee5d32276c952dfe7efd3
MD5 eee1f14f4aa90f0e19768dd397fa85d5
BLAKE2b-256 65254edbe64fb58cae53659d99ed55234d328ebdb69d32163bd224a4ab1a27ca

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fddb199b55a3ef75733362b23aaf4cc7227ce2f7b57653fee78a5e20fe543f93
MD5 87f5227c30d91c27b4cd18ed192adc36
BLAKE2b-256 97467ff26039baec31fbf75c481453b0b3b2d8eb2865aa937b9f3eb2763e926e

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: logxide-0.2.2-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

Hashes for logxide-0.2.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bb3359a629279e2f3cc588568ca67bb50e59e0ce6afc509f32d305f319f1b3ae
MD5 13a882bf200189dd2a7783d5630c5d64
BLAKE2b-256 b2041599603bcb50a25f844384b660d6677cfb8dfe25f012a654f398a66a94e3

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp312-cp312-win32.whl.

File metadata

  • Download URL: logxide-0.2.2-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

Hashes for logxide-0.2.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 00a176d3c0decc6ab12be03d387b4c3d971a7a79bc71b208aa419727289f619f
MD5 25dd6369f828ce379755ad4ae7c3d3a0
BLAKE2b-256 1529de7773089da92576bc01061a670b7e9dc9dbbce1333126bd68ce0b29e79d

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fe6f4209718cdc9d8affdb07de01823eb3f13b550f9a977f12d4f2bacb9619c2
MD5 bca97551e1e59487784dffc0edc3949a
BLAKE2b-256 446ce482817a8d5ef792f6b5976bd0e9958c71cc527a87a874f0cdd9c4661642

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 f6d31f5d100def638f4b192858a173630e3174d3bb0235d57edb02583cb708db
MD5 01ebc2970e89465262f7a0478eae9fb9
BLAKE2b-256 0188cdd7047f3fb8fa7f3ce2431380cffd4231a4bd78bcd2e153267099ddaf05

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 37679709a85be1c62ec052e0109c84fa3c250695095792f7e24938c75567e8bc
MD5 17e65b7be4e3c2f723d0eaff1bb9ae32
BLAKE2b-256 a39b5e9395a540db09e11719411b5dfee23aaf9a478fc9d7e7560394ddb8ae16

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 8ae9e366aa7919a96d40f0e343c4959161ccdf86de7ab86fcdea05e3bef2bfc6
MD5 abb0f7180470994e185e31fd32d9a529
BLAKE2b-256 3f68a8df6838b2a9df3e114e59dd9d16feb0567c052967e6193cf839128ca070

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b62b1436291eb8fad52a3cce0a0786786255e0aa302e12e956af83d0fcbffb87
MD5 65f8d2cdf52cce6fa56fd55fe16d885f
BLAKE2b-256 a6385117c096f0b95a855b6e4e461438931d300fcf2b15f783763e894c20186a

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 0de1e054906b32b8781b69c2a24aee2a4a57a84a4efc57a2f402726fe03c81a6
MD5 9c0a11e9fbe5de0cde6bc0a8e2fc96f7
BLAKE2b-256 1b6a734c925aec0be095dd1a28ca9cccbf8e5daf61e2f3424eadb4d1b6a58f46

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ceb07e6d6fe14ed6ad127b034537b56e8e840ce6724a27f2f853076aa8e54480
MD5 3c34e4d8335dcfcec5c8d8801c64412f
BLAKE2b-256 b42b27e1e0649dd7f4f34fe927d54c20a440340e7bb87fee85c15b57c0113305

See more details on using hashes here.

File details

Details for the file logxide-0.2.2-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for logxide-0.2.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 63c61cb0fffef5fccb8dd0866533aec5a797577bbb4266d611ffcbb26a4ac741
MD5 705c03a757a27fbf686ea5d08086c8d7
BLAKE2b-256 ce0e0eeee6fec8958bf6ecad3f61f1b671c36cc22ab0ed42e353819f75aecc90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page