Skip to content

abhishekMuge/LockFreeLogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Lock-Free Logger in C++

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.


✨ Features

  • βœ… 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

πŸ“¦ Folder Structure

.
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ LogLevel.h
β”‚   β”œβ”€β”€ LogEntry.h
β”‚   β”œβ”€β”€ LockFreeRingBuffer.h
β”‚   β”œβ”€β”€ LockFreeLogger.h
β”‚   └── main.cpp
β”œβ”€β”€ logs/                
└── README.md

πŸ“Š Performance

  1. The logger records the time taken to enqueue log entries and reports average latency at the end of execution.
  2. Ideal for applications where logging should not block real-time processing or introduce jitter.

🧱 How It Works

  1. Producer threads push LogEntry objects into a lock-free ring buffer.
  2. A background thread dequeues and writes logs to disk.
  3. Supports log rotation:
  4. Daily (new file each day)
  5. Max file size (e.g., 10MB)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages