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 ⚠️ Use caplog_logxide fixture
StringIO capture Use file-based logging

If your project requires:

  • Subclassing LogRecord or Logger
  • Custom Python handlers
  • pytest caplog fixture (use caplog_logxide instead)
  • 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: Use caplog_logxide fixture instead

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 ⚠️ Use caplog_logxide fixture instead of caplog
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.16.tar.gz (210.5 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.16-cp314-cp314-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.14macOS 10.12+ x86-64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

logxide-0.1.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

logxide-0.1.16-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.16-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.16-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (2.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686

logxide-0.1.16-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.16-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.16-cp312-cp312-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

logxide-0.1.16-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.16.tar.gz.

File metadata

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

File hashes

Hashes for logxide-0.1.16.tar.gz
Algorithm Hash digest
SHA256 75e6fcdf7ec13a8b4528a82b17c45fc33697a0bed33858551c2b5b8b47b8973c
MD5 7fc879dd2b019027e1c93486bd602463
BLAKE2b-256 fb179031a7b0060312a5ffe6773ef596f588bd7f401acd09d797e9ede59ea13f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 783ba7addfbb2c30ff551bf321d961273d176c0906c5df65d7e6cf1dbcdf2f5b
MD5 29f20d6f77e30e487df7019c718e7b38
BLAKE2b-256 dab06dd906d42971931f1adba73d82926af5aedb0767238fa1f09c4306ea55c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e68a1459b4209082698db1c4ddb7a80b4ed074a2d2a875082ed1d13ae573b562
MD5 7230e3ddeb6dfb3e64cd5446c7f1c188
BLAKE2b-256 66b4411b0eda02ff7c2e3d848beae54b7b28a267c16060a320f5e79bc3d7bb2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6dfb14073fe2de35665169e80c746db5cf3b2764982e81e19e006620d6ccb515
MD5 cd7421a5c6acfe3a04895f09f9672c65
BLAKE2b-256 2fbd29d7ce17098496bfd54170c8699faad0fff1db813383fe1745bff3bd6565

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5ca6eeba6a853872b04dbe07b05324b62e0a41138d0a5a5f207da2f6733a4b75
MD5 fe3f2b3b5b0fa49a154cbf4730c52705
BLAKE2b-256 2757924af386a9010926491586d29cdffd00d6eb187c50c0118329d86a724854

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 664f35d7d94af96c54c74d61abe233f7bbf15ae7550142a818c1a8b810dea3f2
MD5 ca90752480f881e11cf878ce094b11df
BLAKE2b-256 0f02f30a276ac8a48149be92161dce4ac90f5067e6084c3d932e0f9bd301a966

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a3239248a534bced24eb80e5bba1efe355b8a20342b95f29b32ee16ddfbbeeb7
MD5 d9b713f0cf646c566104af80fdee9781
BLAKE2b-256 398327b734747316bd8b792f8a5d9ff9ae69135178c9d2494d28259bfe27f22a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8c63d96b5db5fedd725b7007610fd39bc4a4ad2b2bacd3e8f2264277efda0bdc
MD5 e776d08b48320ecc46893091653b057a
BLAKE2b-256 d4ae08d0fc95edf83dc013fe4c7377a86e3af30a5030f98cc0f2ee2fe6d2a78b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logxide-0.1.16-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.16-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 e3d95a7844646709734b80dba2ea12e0ec4d25e28380422823fb99623bc4e54f
MD5 8726549d0ae92774d968e0a90e037cb5
BLAKE2b-256 27ebd40ba68c12238d0036a1beeeaf5f3a41e9bfe5f8183b750945389f4805cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74d86c99965599632931ceaada91c181bbc8acb69f6d32c53eb5a01aacbe5b42
MD5 a3340fc4b9deba644b7fd69db11ce7f2
BLAKE2b-256 4683e6121ee3b414b0f11bfa699ff10f14db22721bab04f258feae0cff0da800

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 e5c290faa4e273998960081461935a6f9ed6ad02535d75ffc0d60deed512a1ac
MD5 4985e396d0cf88c4ae63648e2a86a563
BLAKE2b-256 e256ed5f6dbdcffbbad596a9ac916b60bfa37cb3e2a4064de5fc21e3a435535a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 86b8a03ee903cd673539982bc93607f460a84effcb5e25050ba9eb388a9a6b47
MD5 f46ac815bb26cf519ca4be34b2cca97a
BLAKE2b-256 f7c85432c5c4c0495cefa70f47cb510b2b945c18a45cc3dcba7ed7a9e3b333bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 cf6fea352989df966d07df94f921c5b51e351cfb1d66dcee497fff3dc4c00889
MD5 0e08ad7780c496b8b5e73f4381f7e4a9
BLAKE2b-256 5ef584d44ce93832965193340436bd29e28e3d41473c93543d3231bdf0f78b0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 91b1145571f3a402b9e7114f33eb6623bf4f3a5a3336f78bf78775f6e6025e66
MD5 958d61a52b675859adb20701b0ae485c
BLAKE2b-256 3dae7e167fcab7de6db55052b86afbf4911f812bbe81e1c26adf68bd9cc809af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 70a3ba9c949d369cca024d8715947136428d973ec05ff811e2e7760f10984dd1
MD5 cfc52545f25f7c6fe1152ee5374b97c9
BLAKE2b-256 0cbac23a155a73bed95c2ed3d3c3de58718a0c6727c031fd54c86a435b1c3ca0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e30b60de42c620f046916f711569d896c9dc72372e185db9cdb8b5df2e8da3b0
MD5 ff75b0bf192b783ec5d241143ec1eb26
BLAKE2b-256 2910a4cfabb4396982837633d1316576c1f1af108232a234706edd072bf14e7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.16-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 35be71c551dbfa2c0a121540c0ffe6ae863ec67abc8a11296326055091e96b54
MD5 25a1f49d11bce021cdad5a9e29d62715
BLAKE2b-256 7c778140626bc1dd1691e7bc69798aa6998973e474402c227f1eb207eb9bd05e

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