Skip to main content

High-performance, Rust-powered drop-in replacement for Python's logging module

Project description

LogXide

High-Performance Rust-Powered Logging for Python

LogXide is a high-performance logging library for Python, delivering exceptional performance through its native Rust implementation. It provides a familiar logging API but prioritizes performance over full compatibility.

Key Features

  • High Performance: Rust-powered logging with exceptional throughput
  • Familiar API: Similar to Python's logging module (not a drop-in replacement)
  • Thread-Safe: Complete support for multi-threaded applications
  • Direct Processing: Efficient log message processing with native Rust handlers
  • Rich Formatting: All Python logging format specifiers with advanced features
  • Level Filtering: Hierarchical logger levels with inheritance
  • Sentry Integration: Automatic error tracking with Sentry (optional)

⚠️ Important: Not a Drop-in Replacement

LogXide is NOT a drop-in replacement for Python's logging module. It prioritizes performance over compatibility:

Feature Status Notes
Basic logging API getLogger, info, debug, etc.
Formatters PercentStyle, StrFormatStyle, StringTemplateStyle
Rust handlers FileHandler, StreamHandler, RotatingFileHandler, HTTPHandler, OTLPHandler
Custom Python handlers Not supported - use Rust handlers only
Subclassing LogRecord Rust type, not subclassable
Subclassing Logger Rust type, not subclassable
pytest caplog Not compatible
StringIO capture Use file-based logging

If your project requires:

  • Subclassing LogRecord or Logger
  • Custom Python handlers
  • pytest caplog fixture
  • Full stdlib logging compatibility

→ Use standard Python logging instead.

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!')

LogXide automatically installs itself when imported.

Installation

# Basic installation
pip install logxide

# With Sentry integration
pip install logxide[sentry]

# Development dependencies
pip install logxide[dev]

📘 Usage Guide - Common mistakes, correct patterns, and troubleshooting

Documentation

Sentry Integration

LogXide includes optional Sentry integration for automatic error tracking:

# Configure Sentry first
import sentry_sdk
sentry_sdk.init(dsn="your-sentry-dsn")

# Import LogXide - Sentry integration is automatic!
from logxide import logging

logger = logging.getLogger(__name__)
logger.warning("This will appear in Sentry")
logger.error("This error will be tracked")

Features:

  • Automatic detection of Sentry configuration
  • Level filtering (WARNING and above sent to Sentry)
  • Rich context including stack traces and custom data
  • Zero configuration required

Performance

LogXide delivers exceptional performance through its Rust-powered native architecture. See our comprehensive benchmarks for detailed performance analysis.

Python 3.12 Benchmark Results (File I/O)

Real-world file logging performance (100,000 iterations):

Test Scenario LogXide Picologging Python logging vs Pico vs Stdlib
Simple Logging 446,135 ops/sec 372,020 ops/sec 157,220 ops/sec +20% +184%
Structured Logging 412,235 ops/sec 357,193 ops/sec 153,547 ops/sec +15% +168%
Error Logging 426,294 ops/sec 361,053 ops/sec 155,332 ops/sec +18% +174%

Key highlights:

  • 15-20% faster than Picologging (C-based) in production file I/O scenarios
  • 2.7x faster than standard Python logging - upgrade with zero code changes!
  • 2.5x faster than Structlog across all tests
  • Native Rust I/O provides measurable performance advantages
  • Consistent performance across all logging patterns

Limitations

LogXide uses Rust-native handlers only for maximum performance:

  • Rust handlers only: FileHandler, StreamHandler, RotatingFileHandler, HTTPHandler, OTLPHandler
  • No custom Python handlers: logger.addHandler() rejects Python logging.Handler subclasses
  • No subclassing: LogRecord, Logger are Rust types (not subclassable)
  • No StringIO capture: Use file-based logging for tests
  • No pytest caplog: Not compatible with Rust native architecture

Alternatives to LogRecord Subclassing

Instead of subclassing LogRecord, use these approaches:

Use Case Alternative
Add custom fields Use extra parameter: logger.info("msg", extra={"user_id": 123})
Add metadata to all logs Use global_context in HTTPHandler
Transform log output Use transform_callback in HTTPHandler
Dynamic context per batch Use context_provider in HTTPHandler

Example - Adding custom fields:

from logxide import logging

logger = logging.getLogger('myapp')

# Use extra parameter (supports complex types: int, dict, list)
logger.info("User logged in", extra={
    "user_id": 12345,
    "ip": "192.168.1.1",
    "metadata": {"browser": "Chrome", "version": 120}
})

Example - Global context for all logs:

from logxide import HTTPHandler

handler = HTTPHandler(
    url="https://logs.example.com",
    global_context={
        "application": "myapp",
        "environment": "production",
        "version": "1.2.3"
    }
)

Example - Custom JSON transformation:

handler = HTTPHandler(
    url="https://logs.example.com",
    transform_callback=lambda records: {
        "logs": [{"msg": r["msg"], "level": r["levelname"]} for r in records],
        "meta": {"count": len(records)}
    }
)

Example - OpenTelemetry OTLP (Protobuf):

from logxide import OTLPHandler

handler = OTLPHandler(
    url="http://localhost:4318/v1/logs",
    service_name="my-service"
)

Compatibility

  • Python: 3.12+ (3.14 supported)
  • Platforms: macOS, Linux, Windows
  • Dependencies: None (Rust compiled into native extension)

Third-party Library Compatibility

Library Compatible Notes
Flask Works with app.logger
Django Works with Django logging
FastAPI Works with Uvicorn
pytest ⚠️ caplog not supported, use file-based testing
Sentry Auto-integration supported
structlog Requires custom handlers
infra_basement Requires LogRecord subclassing

Contributing

We welcome contributions! See our development guide for details.

# Quick development setup
git clone https://github.com/Indosaram/logxide
cd logxide
pip install maturin
maturin develop
pytest tests/

License

[Add your license information here]


LogXide delivers high performance for applications that don't need full logging compatibility.

Built with Rust for high-performance Python applications.

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.1.10.tar.gz (222.3 kB view details)

Uploaded Source

Built Distributions

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

logxide-0.1.10-cp314-cp314-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.14Windows x86-64

logxide-0.1.10-cp314-cp314-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

logxide-0.1.10-cp314-cp314-macosx_10_12_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

logxide-0.1.10-cp313-cp313-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.13Windows x86-64

logxide-0.1.10-cp313-cp313-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

logxide-0.1.10-cp313-cp313-macosx_10_12_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

logxide-0.1.10-cp312-cp312-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.12Windows x86-64

logxide-0.1.10-cp312-cp312-win32.whl (1.8 MB view details)

Uploaded CPython 3.12Windows x86

logxide-0.1.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

logxide-0.1.10-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ s390x

logxide-0.1.10-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ppc64le

logxide-0.1.10-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (2.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686

logxide-0.1.10-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARMv7l

logxide-0.1.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

logxide-0.1.10-cp312-cp312-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

logxide-0.1.10-cp312-cp312-macosx_10_12_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: logxide-0.1.10.tar.gz
  • Upload date:
  • Size: 222.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for logxide-0.1.10.tar.gz
Algorithm Hash digest
SHA256 3bcfff5240c53d12c9fda9b35494c535051b7315155f761df9079d46b8866c00
MD5 65eca3c56c8b16818e7d6b1b5f127153
BLAKE2b-256 142e97016ee808856e90b879685e4207af39209de67ca5fa8766fb9ffff51c61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 2b64076baf24dca4388d0749189555c281ab646926f3b3530918ca1b4d78eb66
MD5 e2ab7aeef94616229f9e253925a060ba
BLAKE2b-256 84b58ecafa6945650fb2878835a0b5118fdafe938378ab1dededd54e092c6600

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f5370b0236dcaae44d94eaf2e12f36fa32b97f4dd75209f8e6a7db5cfa0cb054
MD5 ab0383a4b13876101549fa275a3c0c58
BLAKE2b-256 a47244fcec014c914940f3789eccea578a95a37809961521da0be2cf3ce82eec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a3d53f339c3b8524601c1b4a366a321ffc03c3c01afdb46fc754ea1f40f5c174
MD5 854e88c27e0476731e91faebd32b26c2
BLAKE2b-256 700095cd639d2f64f87843bfb8dbe701d4095ed53a5fc45d052a0fb24189628f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 31ac1a507189fddacaa9500ec887e0068f25105fbb3f44532e112228546c3ce0
MD5 01e4757e8c920adb3972e57ae8bc6387
BLAKE2b-256 18fdd3650545a8c8b0db82436dcba69e16a29c4fa26bf3322cf68de225d511ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2ab69ba6656349bf377a218bba1db37aaf7b2e1fa23190f9f29f9ab0c8cce37c
MD5 84a6acf0c642e4c9aab142792907aa05
BLAKE2b-256 9c75513e642e0450b6744a15f7e4873be8abaf616762426f9c81d5edb08144d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5fd44f47a1104bfb3b631e9562a878824494d8969d75ed4e506ad5b788a6f313
MD5 c277bb675f22ffcf4e05d99350c5432b
BLAKE2b-256 9e72dad1e5312a0ba4106f6a11ffd812820ef4b2334b836855c0e0f02266cd91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4e3f9443631fef35160a6959685987095d62e4d6e88088e6c8802f81d8b69708
MD5 a7ac2cd5642ea8a516777b40a5d7329e
BLAKE2b-256 830134d46bebaab1bf7453ee9cb12ac1546d0fcac71ed751b06e3f4dd917f092

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logxide-0.1.10-cp312-cp312-win32.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for logxide-0.1.10-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 54275924c2ad3cf09d9000c389bf504cd158b0014fb4bafbb573bf960942bfd3
MD5 9851cf52e0b18087c72b90e2ea547ec4
BLAKE2b-256 0ddd80870064c0a024d35447c3e1c80fa4cb86aeb622f058e1dcf8aee542ca16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 13c21485696a864198ff88a2209f579905d8d3cf78f70c9f34fe43d327549280
MD5 5c5e74aa629c971f07633122e5590fbe
BLAKE2b-256 4b7b56deb630dc1df121b4a21793aca2bc207c859798b0df12188b67cffbd567

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 c23314fcc3c0da78cb5041dbc0e71ed41003f1ceca87d23c4c3c285d8068fa5d
MD5 12f10bb4faac20183673fe98009bcb32
BLAKE2b-256 d325115966b23f1665528e522ca9d6e354244c2dbee547fc7928d03f31bb3a19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 9d9749debe7f431ec8a4eddfa21f317ed4b4c9dc7ad8362ef56ac8b473186a92
MD5 68b1c06305e0e37bf463efa87e8a65c0
BLAKE2b-256 6c3288dcea73db63447b5e4c1de591360905d2c7fb8339cd138815b46c9f9083

See more details on using hashes here.

File details

Details for the file logxide-0.1.10-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for logxide-0.1.10-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 e22e9de3feba9ecae10556a6c31b58fe3559812b2a1977761b9de8dfc86021e4
MD5 c37d1a16efb7dc86ddfbe5fe8b066777
BLAKE2b-256 b9252108d2a55e40d8e56cf82eb0b600cff2e91c88a16d8e13411fee098414c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 09564dc424ed8485f2ee6fcd0de600e1074d1a31922eb888f3076d6b78837e1a
MD5 7dccde31f794d998e831f9a6593ca49d
BLAKE2b-256 d756ab1088d1fb459afaedff4ed882a3657e3c82b22cba1aab31fb780e9f26c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b92eac12f531f87d6e96190634b5fc639e26f9f8c5e37f8d7a84ddffa49f53ce
MD5 68dc014e0b8c40943c85688147a16cf9
BLAKE2b-256 5a5caf75386f923630601390dc55fd2963ae7fba2ba4b697c1da4e792b0dc738

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b7cb0de49eb3181a0c2e33e067a6640d67561666a7eeda9453d6bc640d82aa87
MD5 f956341ea4089bfa44fd347e65a1a3d9
BLAKE2b-256 bb05c8392cd2d9e7b0625fff9f2b6cabb868eadc6f190335750652878b8f5cf1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.10-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b6f16c02363b213fb0c2b0e735798a8b5564bff3eded6878568d9154dc68304c
MD5 326ee691732089eeaccc950e444610af
BLAKE2b-256 dee307ff2ec9c76b07eb3bd78ce798baad956719d08df36290dd78023a50c216

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