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 80x 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.0a1.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.0a1-cp312-cp312-macosx_11_0_arm64.whl (280.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file lo3-0.3.0a1.tar.gz.

File metadata

  • Download URL: lo3-0.3.0a1.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.0a1.tar.gz
Algorithm Hash digest
SHA256 0e7c09c0ea1f874f79616a1239729837649eb0fef4ba97492297688c046f042d
MD5 f62e9e2d58996fbfff2dc04be57103d0
BLAKE2b-256 d4151d831d8955f1d8b3c41c4a6ee74fcbdcf4d137d25156b3454214c992a66b

See more details on using hashes here.

File details

Details for the file lo3-0.3.0a1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lo3-0.3.0a1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 823d12ec51c35415279a85d8ba705d05a564e42c34c0eb815be470fdb49c355e
MD5 e3e8ab21fff521b2776067e08edf6b88
BLAKE2b-256 b1b70ed96c775b47254807ac27c9bb63010e7eed18e7cd8aabfcef2fced5d937

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