The memory log facility allows a program to maintain a rotating log of recent messages in memory. The mlog facility provides routines to write initialize the log buffer, write messages to the buffer and dump the current buffer contents to the log file. The mlog facility allows a program to keep detailed logs without being slowed down by disk I/O. The log contents can either be dumped under program control (when an error or interesting condition is detected) or examined from a core file after a program crash.
The memory log is only really usefull for stable production codes where you can be relatively certain that large scale memory corruption won't occur (otherwise the contents of the log buffer can't be trusted). To use the memory log facility, simply build and install the mlog libraries (using make all and make install), add the memory log calls to your program (mlog_init() to initialize the memory log facility, mlog() to write message to the buffer and mlog_dump() to dump the current buffer contents to the log file) and link your program against the mlog library (using the -lmlog option).
The mlog tarball is here.