Skip to main content

Faster logger than python native logging package.

Project description

Lo3: High-Performance Python Logging with Rust (Alpha Version)

Overview

Lo3 is an extremely fast, Rust-based logging solution for Python applications. It provides a simple Python interface while leveraging Rust's performance to deliver logging capabilities up to 80 times faster than Python's native logging module in high-volume scenarios.

Please Note: This is an alpha version with limited features. Currently, RustPyLogger only supports logging to files. Additional features are in active development.

Current Features

  • High-performance logging to files (up to 80x faster than Python's native logging)
  • Python-friendly API with familiar log levels (debug, info, warning, error)
  • Thread-safe operations
  • Efficient handling of high-volume logs
  • Support for additional context (kwargs) in log messages
  • Minimal CPU and memory overhead

Planned Features (In Development)

  • Support for all handlers provided in logging
  • Structured logging support
  • Asynchronous logging
  • Log rotation and archiving
  • Configurable log formatting

Installation

  • via pypi:
    pip install lo3
    

Usage

Here's a simple example of how to use Lo3 in its current alpha state:

from lo3 import RustLogger

# Initialize the logger (currently only supports file logging)
logger = RustLogger("app.log")

# Log messages at different levels
logger.debug("This is a debug message", {"extra": "info"})
logger.info("This is an info message")
logger.warning("This is a warning")
logger.error("This is an error", {"error_code": 500})

# Ensure all logs are written
logger.flush()

Performance

In our benchmarks, Lo3 showed significant performance improvements over Python's native logging module:

  • Test: Writing 1,000,000 log messages (250,000 each of debug, info, warning, and error) to a file
  • Lo3: ~101.39 seconds
  • Python's logging module: ~522.20 seconds

This represents an ~5x(~80%) speedup in this high-volume logging scenario.

Benchmarking

To run the benchmarks yourself:

  1. clone https://github.com/DataEnggNerd/MH370
  2. Run the provided tests script:
    python tests/test-lo3.py
    python tests/test-logging.py
    

Contributing

As this is an alpha version, we welcome contributions, especially for the features currently in development. Please feel free to submit pull requests, create issues, or suggest new features.

Limitations

  • Currently only supports logging to files
  • No support yet for log rotation or size limits
  • Configuration options are limited in this alpha version

Acknowledgments

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

lo3-0.3.1a0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

lo3-0.3.1a0-cp312-cp312-macosx_11_0_arm64.whl (280.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file lo3-0.3.1a0.tar.gz.

File metadata

  • Download URL: lo3-0.3.1a0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.1

File hashes

Hashes for lo3-0.3.1a0.tar.gz
Algorithm Hash digest
SHA256 6dcdc9470ade6552482d4917078ed19a41113d3e32abc259b242249dfe5be075
MD5 b646496830e58ad6bb98363e4134f851
BLAKE2b-256 f73d0993641e5cf396faa9216b7b980d528e2b5bac419b7b07b7ebf28b7ba117

See more details on using hashes here.

File details

Details for the file lo3-0.3.1a0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lo3-0.3.1a0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c9329eb7175bf3670b60cb383302060179efb134be50441cdaa7b7f6417a406
MD5 a671704e44cd491fa1efe292067824ac
BLAKE2b-256 3630a054d699467f98b3afadf827b9c2d9343d443d18bfff8ba653c7251ed83c

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