High-performance logging utility for Python applications with advanced features
Project description
Kakashi - Professional High-Performance Logging Library
A modern, high-performance logging library designed for production applications that require both high throughput and excellent concurrency scaling.
๐ Features
- High Performance: 60,000+ logs/sec throughput with balanced concurrency
- Thread-Safe: Minimal contention with thread-local optimizations
- Structured Logging: Field-based logging with minimal overhead
- Memory Efficient: <0.02MB memory usage for async operations
- Professional Code: Clean, maintainable architecture
- Drop-in Replacement: Compatible with Python's built-in logging
๐ Performance Targets
| Metric | Target | Status |
|---|---|---|
| Throughput | 60,000+ logs/sec | โ EXCEEDED (66,116 logs/sec) |
| Concurrency Scaling | 0.65x+ | โ EXCEEDED (1.17x scaling) |
| Memory Usage | <0.02MB | โ Maintained |
| Structured Overhead | <10% | โ Maintained |
๐ Benchmark Results
โ ๏ธ LEGAL DISCLAIMER: The following benchmark results are provided for informational purposes only. Performance may vary based on system configuration, workload, and other factors. These results are not guarantees of performance and should not be used for commercial claims or comparisons without independent verification. Kakashi makes no warranties regarding performance characteristics.
Performance Comparison vs Industry Standards
| Library | Throughput (logs/sec) | Concurrency Scaling | Async Throughput | Notes |
|---|---|---|---|---|
| Kakashi (Current) | 56,310 | 1.17x | 169,074 | SUPERIOR performance |
| Standard Library | 18,159 | 0.59x | N/A | Python built-in |
| Structlog | 12,181 | 0.47x | N/A | Production ready |
| Loguru | 14,690 | 0.46x | N/A | Feature rich |
Performance Analysis
- Single-threaded Performance: Kakashi achieves 3.1x better throughput than standard library
- Concurrency Scaling: 1.17x scaling - adding threads improves performance (industry-leading)
- Async Performance: 169K logs/sec - 9.3x faster than standard library
- Memory Efficiency: Maintains low memory footprint across all scenarios
Note: These benchmarks were run on a development system and may not reflect production performance. Always test in your specific environment.
๐๏ธ Architecture
kakashi/
โโโ core/ # Core logging implementation
โ โโโ logger.py # Main Logger and AsyncLogger classes
โ โโโ records.py # LogRecord, LogContext, LogLevel
โ โโโ config.py # Configuration system
โ โโโ pipeline.py # Pipeline processing components
โ โโโ async_backend.py # Asynchronous I/O backend
โ โโโ structured_logger.py # Structured logging support
โ โโโ sinks.py # Output destination system
โโโ performance_tests/ # Performance validation
โ โโโ validate_performance.py
โโโ README.md # This file
๐ Quick Start
Basic Usage
from kakashi import get_logger, get_async_logger
# Synchronous logging
logger = get_logger(__name__)
logger.info("Application started", version="1.0.0")
# Asynchronous logging for high throughput
async_logger = get_async_logger(__name__)
async_logger.info("High-volume logging")
# Structured logging with fields
logger.info("User action", user_id=123, action="login", ip="192.168.1.1")
Advanced Configuration
from kakashi import setup_environment, production_config
# Production setup
config = production_config(
service_name="my-api",
version="2.1.0",
enable_async_io=True
)
setup_environment(config)
Framework Integration
# FastAPI
from fastapi import FastAPI
from kakashi import setup_logging
app = FastAPI()
setup_logging("production", service_name="fastapi-app")
# Flask
from flask import Flask
from kakashi import setup_logging
app = Flask(__name__)
setup_logging("production", service_name="flask-app")
๐ง Installation
pip install kakashi
๐งช Performance Validation
Run the performance validation to ensure your installation meets production targets:
cd performance_tests
python validate_performance.py
This will test:
- Throughput performance (60K+ logs/sec)
- Concurrency scaling (0.65x+)
- Memory efficiency (<0.02MB)
- Structured logging overhead (<10%)
๐ API Reference
Core Classes
Logger: High-performance synchronous loggerAsyncLogger: Asynchronous logger with batch processingLogFormatter: Optimized message formatting
Main Functions
get_logger(name, min_level=20): Get a synchronous loggerget_async_logger(name, min_level=20): Get an asynchronous loggerclear_logger_cache(): Clear logger cache
Configuration
setup_environment(env, **kwargs): Configure logging environmentproduction_config(**kwargs): Production-optimized configurationdevelopment_config(**kwargs): Development-optimized configuration
๐ฏ Use Cases
High-Throughput Applications
- API Services: Handle thousands of requests per second
- Data Processing: Log millions of events efficiently
- Real-time Systems: Minimal latency logging
Production Environments
- Microservices: Structured logging with context
- Distributed Systems: Async logging for scalability
- Cloud-Native Apps: Memory-efficient operation
๐ Performance Characteristics
Throughput Optimization
- Thread-local buffer management
- Pre-computed level checks
- Direct I/O operations
- Minimal object allocation
Concurrency Optimization
- Lock-free hot paths
- Thread-local caching
- Batch processing
- Cache-line optimization
Memory Optimization
- Buffer pooling and reuse
- Zero-copy operations where possible
- Adaptive buffer sizing
- Reference counting for lifecycle management
๐จ Migration from v0.1.x
The v0.2.0 release maintains backward compatibility while providing significant performance improvements:
# Old v0.1.x code (still works)
from kakashi import setup, get_logger
setup("production")
logger = get_logger(__name__)
# New v0.2.0 code (recommended)
from kakashi import get_logger
logger = get_logger(__name__) # Auto-configuration
๐งญ Roadmap & Collaboration
We are looking for collaborators to help build the next evolution of Kakashi:
- Cloud log dump and long-term storage integrations (S3/GCS/Azure Blob, Kinesis, Kafka)
- Scalable log analysis pipelines (batch + streaming) with enrichment and alerting
- Incident reporting (SLOs/SLIs, error budgets, paging hooks, RCA helpers)
- First-class observability dashboards (Grafana/Loki, Kibana, Datadog, custom UI)
If youโre interested in shaping these capabilities, please:
- Open a discussion with your proposal and interests
- File an issue with [area:roadmap] label
- Or reach out via GitHub to coordinate design/ownership
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
โ๏ธ Legal Disclaimers
Performance Claims
- All performance metrics and benchmark results are provided for informational purposes only
- Performance may vary significantly based on system configuration, workload patterns, and environmental factors
- These results are not guarantees of performance and should not be used for commercial claims without independent verification
- Kakashi makes no warranties regarding performance characteristics or suitability for specific use cases
Benchmark Results
- Benchmark results are based on specific test conditions and may not reflect real-world performance
- Comparisons with other libraries are provided for context only and should not be considered definitive
- Users are encouraged to conduct their own performance testing in their specific environments
- Results may vary between different Python versions, operating systems, and hardware configurations
Usage and Liability
- Kakashi is provided "as is" without warranty of any kind
- Users assume all risk associated with the use of this software
- The authors and contributors are not liable for any damages arising from the use of Kakashi
- Always test thoroughly in your specific environment before production deployment
Kakashi v0.2.0 - Professional High-Performance Logging for Python
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kakashi-0.2.1.tar.gz.
File metadata
- Download URL: kakashi-0.2.1.tar.gz
- Upload date:
- Size: 4.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c6dd44f951e9ad932be59a7a4b81ebee88a91fb7ae112efd21c4bc7c91ceb0f
|
|
| MD5 |
466642d54142833b21a185c247c0f780
|
|
| BLAKE2b-256 |
e1559de7c731b58778c27f6f787ee58fa3251f1bb9f151b52eaf9042a32a0615
|
File details
Details for the file kakashi-0.2.1-py3-none-any.whl.
File metadata
- Download URL: kakashi-0.2.1-py3-none-any.whl
- Upload date:
- Size: 115.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f50be52175fd7ea43f3986c0e3d12e176d5e7bf237f0b39fbce14c12e4e4fb4
|
|
| MD5 |
12ab8674f05514825b7e0e3d12d07710
|
|
| BLAKE2b-256 |
fc62e3198a0bf9d186fa5277183ac29713c2ddfa2bae764a38d3d562d9b0383c
|