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.17.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.17-cp314-cp314-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.14macOS 10.12+ x86-64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.12macOS 11.0+ ARM64

logxide-0.1.17-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.17.tar.gz.

File metadata

  • Download URL: logxide-0.1.17.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.17.tar.gz
Algorithm Hash digest
SHA256 8ea21d089ebed823edb8b63d2aa5c7f5065968638e0eba5288f963372b5f4359
MD5 9a55bbbfb6e2fdcc0f50d5534bc421fc
BLAKE2b-256 fb82ec53a83972a51ff05134df260afdae75b88f5d4184a93e26feef8c1bad2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 4b6d1036d7015a27bab9d9e992f6b84ef0386fe2070bd23c34f1f3283cea0b84
MD5 9b4a4c9548cb3d68bd272622d669a29c
BLAKE2b-256 acdccba707dc6a03cbe40958017fa015c00b743b60c31d58d479c37dedee6369

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 172f569c9d36b789df54c915a14c3a6aeecd0934d14b1d692b66c11e56a200dd
MD5 fd10cee4b1b06d76a9ec3d46f5e3c42f
BLAKE2b-256 7f3684cdf8d56a9956d41250cab572b501ae2cebdd7c53ca30f81a2339d8e5b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9c5dafa898718ea306a9cb78de8c27997fc768f450f77651e89fcedd8573a3b5
MD5 7174f417936999029b6671c075e0f2cc
BLAKE2b-256 d5cc72d156e9a696f50fc942502e63972af37ef5179d19c89f0c514eb77a0ebe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f3a390e8be5d5d362a474e84b831fbdeec2d8df9cd53e2c85cdb426b5cbf4ffc
MD5 1af1a79f091d4539e793ebe4283a1d7a
BLAKE2b-256 6dabd5b373437dc2a94c2fa5e4a2d73e1c75991cdebff2f4d676fd70bc1abdfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2f708c79f9ab9a33f1663937db622d7f9d3746d5d4e6ef0f63d292fcb83ce9b7
MD5 cee6cc48914fe92852e3f7cc2aad91c6
BLAKE2b-256 5d73d0cb8da47f0b9da52fdc7f4c634bf1ecad798653397bd80e518e850f21da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 348228a9ae0d327889b8835ed08c72e6e2ca38057aad4d3e312b5a35c1d6511b
MD5 993a16a6bb9ba6f905000faedc40dba3
BLAKE2b-256 1741f9a3c78476c83085b07afda7a26cc24d392ad68dae47641ae2dacfb2da2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3e5e5e1cb930e5942ce426a4e007e66b9a0eaac4fd4420410f2bdde0f3fe3843
MD5 212ea8ea8d526e9fc78338c63882fde2
BLAKE2b-256 ba0abe381b1f7a758d673293418a64071f47f856787dab5f2396f73d1d4b4616

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logxide-0.1.17-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.17-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 a11a9397eac14035f2a175f45adc4dcf78aee0d6e9d26df54dd0f1330f40155e
MD5 80d066ef23b78a3839814c7e0a5f6b7b
BLAKE2b-256 50a7d1914ac2f67bd6367f92433d4e030ad89c0313859f65bc2b26872e729908

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a00771345d791906e6421ec0d7f858fe22afdafbbf9cd42537931cf706c47ed
MD5 1405ac9c8943dc220e04a14bb480b236
BLAKE2b-256 ea9c1f503826b1b4064c209524f76d1b90c578ee791a0eb57a03d6abe2fe2ac0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 4f0ac1588fc8da21cc816e44702fad66a28847dc935e5e4fea1125f3892e6c6a
MD5 2df97096d9480de478841258c281fc24
BLAKE2b-256 0967e576e37ae8993aa08855c062c54299b499d7bc452f8ac41134060b8296e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 15dbbd4270fbe895df4eae0ced303f461d1b777239d81c1fb136423949776e6d
MD5 5775bfa650a950d2e69fed3bf74f3965
BLAKE2b-256 d9143cd503816f12880d7261bd4839c627ff621da22038d8cdb408c45b1f25cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 bc4a242fe6bb6ab4d7852fa91e0d109bd28b5a7ee1d16385ae9af7054eaf470b
MD5 3106e57a34a5ac12d7ffa8f7520a13fc
BLAKE2b-256 f78ee96a8ec8317ecbe39877e0e10e740c94bff843904eae6a12b75d14662d91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 88c3cfc823463ae923f2d0a949ac9a6b0072706e88539a0c0ec9938d30a1ad69
MD5 f19f08f9897d6509148a19974077210d
BLAKE2b-256 74d92f16724415d9f0831050b541699f7fefc9c266a57e65c7d1b175e83f0f16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0f76372cc1a64cf1661c018ad434fb513efd551ae2a01cfe91e954639df51128
MD5 caf5bd7bc43553ebaaf7025fd5caa4c2
BLAKE2b-256 38557b7508ce1cf2d6515c3b38b7ecbca0ae9b85e72ca664c66bd4fd071d92dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 207ba2abe1ece0adf97b27c9dffb39f391b11b872cb0c1c06a63ddcb591d1718
MD5 033f61020ad153fbc56e557a82a6c4cf
BLAKE2b-256 4cabdb25ab43b1e5e0e4f8338eac959963deef46ae34beba979225e7ff3b0a56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logxide-0.1.17-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0396f4d69545efcd97b395e4aaddc59eaf149ac4a127a2bb498f1517ff498003
MD5 b33b513aa64788f9d0c135ce8c57870c
BLAKE2b-256 c7ad82043d9e9b9196b2e1c244f70b24b50e1d0792cdc9fe40433a1760582bec

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