A high-performance, lock-free logging utility written in modern C++. This project is designed for ultra-low-latency logging in multithreaded environments such as trading systems, real-time analytics, or high-frequency data pipelines.
- ✅ Lock-Free Logging (SPSC ring buffer)
- ✅ Thread-safe background writer
- ✅ Log Levels: INFO, WARN, ERROR
- ✅ Timestamped Messages
- ✅ Pre-allocated message buffer (no dynamic allocation during log)
- ✅ Log Rotation (by date and file size)
- ✅ Performance Benchmarking (average latency per log call)
- 🛠️ Easy to extend to multi-producer with Boost or custom lock-free queue
. ├── src/ │ ├── LogLevel.h │ ├── LogEntry.h │ ├── LockFreeRingBuffer.h │ ├── LockFreeLogger.h │ └── main.cpp ├── logs/ └── README.md 📊 Performance
- The logger records the time taken to enqueue log entries and reports average latency at the end of execution.
- Ideal for applications where logging should not block real-time processing or introduce jitter.
🧱 How It Works
- Producer threads push LogEntry objects into a lock-free ring buffer.
- A background thread dequeues and writes logs to disk.
- Supports log rotation:
- Daily (new file each day)
- Max file size (e.g., 10MB)