A Low-Latency In-memory C Logging Library


zlog is a C in-memory logging library. It allocates a buffer in memory for efficient logging. The library flushs the buffer to the log file (or stdout) when the buffer is full.

The program can also explicitly flush the log, or create a flushing thread (provided by the library) to flush the buffer every a period of time. zlog provides printf-like interfaces for formatting the log and zlog is thread safe, which makes it a convenient logging tool for C programs.

Why in-memory logging?

The main reason is for very low latency. Logging is an important tool for debugging and performance analysis. However, for some critical software components, timing is very sensitive and the cost of touching the I/O is not acceptable. In-memory logging is a good fit for these software.


An example program named example.c for how to use zlog can be found in the source code.

Source code

Download the source code of zlog. Released to the public domain.


Bug report/feedback to Zhiqiang Ma.

Last updated: Dec. 19, 2017
Hosted by SysTutorials