High-Performance, Cross-Platform Logging Library for C/C++
Author: Thuan Nguyen Thai
Other contributors: None
Created: April 24, 2025
- Providing a logger which is simple-STABLE-powerful for embedded devices to PC and mainframe with flexible configuration.
- Multi-process C/C++ logger, portable.
- A meaningful demo for Systems Programming inspired by W. Richard Stevens(1951-1999).
- POSIX thread/POSIX APIs in UNIX-Like.
- Win32 APIs in Windows.
- No.
| Component | Description |
|---|---|
Log folder |
[Mandatory] pathfolder= |
Daily |
[Mandatory] |
Log rotation |
[Mandatory] rotation_size= |
Time |
[Mandatory] [yyyy-mm-dd hh-mm-ss.nano] |
Info |
[Mandatory] [tid] [pid] [file:func:line] |
Number of CPU |
[Mandatory] ncpu= |
topic |
[Optional] topic=, can comment this feature. |
Log level |
[Mandatory] level=. |
Buffer size |
[Mandatory] buffsize=. |
Timer trigger |
[Mandatory] trigger=. |
Safe size of message |
[Mandatory] max_sz_msg=. |
Shared memory key |
[Mandatory] shared_key=. |
process_mode |
[Mandatory] process_mode=. |
SimpleLog-Challenge provides 5 key APIs for initializing, logging, and process control:
| APIs | Description |
|---|---|
int spc_init_log_ext(SPC_INPUT_ARG *input); |
[Mandatory] Initialize the logger with extended input settings. |
int spc_finish_log(); |
[Mandatory] Finalize and clean up the logger. |
spclog(log_level, fmt, ...); |
[Mandatory] Log a message with the specified level. |
spclogtopic(log_level, topic_index, fmt, ...); |
[Optional] Log by topics= from 1 to n. |
LLU spc_update_processid(); |
[Optional] Update process ID, typically used after fork() example. |
- No. It should be one more option. It should NOT alternate any libraries, but is really worthy to try with new applications.
- No.
- Does this proposal require a new repository? No.
- Which repositories are expected to be modified to execute this design?
phosphor-logging
- Benchmarks on Windows, Linux, macOS vs spdlog
- 1B record stress test Windows
- 1B record stress test Linux
- However, you can try with Benchmarking Linux 8 cores first ( find How to run). And do same with Windows/MAC OSX.
- UNIX Network Programming, Volume 2: Interprocess Communications, Second Edition
- Unix Network Programming: The Sockets Networking API