A lightweight and easy-to-use C++ logging class that supports multi-threaded environments.
- C++-17 Standard, unicode character set
- Thread-safe class (Singleton access)
- Easy to use with macro function
- Various Log levels (TRACE, DEBUG, INFO, WARN, ERROR, FATAL)
- Automatic log file rotation (100 MB max per file)
- Logs stored in per-day folders (e.g.,
C:\MyLog\20250612) - Configurable log level via
log_conf.ini - Only tested in Windows
CLogManager.h– Header file for the logging managerCLogManager.cpp– Implementation file
Write C:/MyLog/log_conf.ini with the following content:
[LOG_SETTING]
log_level = 1
# 0: trace, 1: debug, 2: info, 3: warn, 4: error, 5: fatal#include "CLogManager.h"
void callbackFuncB(const double& data)
{
LOG_DEBUG("this is callback B");
LOG_WARN("received data is : %f", data);
}
void callbackFuncA()
{
LOG_INFO("this is callback A");
// Possible Execption..
LOG_ERROR("Error occured :(");
}Logged path : C:\MyLog\20250612\20250612_134508.txt
[2025-06-12 13:45:30.112] [INFO] callbackFuncA (Line : 5) -> this is callback A
[2025-06-12 13:45:30.114] [DEBUG] callbackFuncB (Line : 2) -> this is callback B
[2025-06-12 13:45:30.113] [ERROR] callbackFuncA (Line : 8) -> Error occured :(
[2025-06-12 13:45:31.116] [WARN] callbackFuncB (Line : 3) -> received data is 123.45- Log files are automatically created inside daily folders
C:\MyLog\YYYYMMDD. - If a log file exceeds 100 MB, a new file with timestamp is created.
- Log output is buffered via an internal queue and flushed by a worker thread.
- Uses standard C++17 (
<thread>,<mutex>,<chrono>,<filesystem>).
This project is licensed under the MIT License – see the LICENSE file for details.
- Name: Seongchang Park
- Email: scsc1125@gmail.com