librfn
An ad-hoc utility library
|
Log text messages to a circular memory buffer. More...
Functions | |
void | vmlog (const char *fmt, va_list ap) |
Log a message using a variable argument list. More... | |
void | mlog (const char *fmt,...) |
Log a message. More... | |
void | vmlog_nice (const char *fmt, va_list ap) |
Log a message using a variable argument list, if there is space to do so. More... | |
void | mlog_nice (const char *fmt,...) |
Log a message, if there is space to do so. More... | |
void | mlog_clear (void) |
Clear all data from the log. More... | |
void | mlog_dump (FILE *f) |
Format the log and write it to the supplied file pointer. More... | |
char * | mlog_get_line (int n) |
Format the Nth line of the log. More... | |
Log text messages to a circular memory buffer.
A very fast text-centric circular log with deferred string formatting. Deferred formatting permits extremely low overhead logging; Each message is recorded using just four pointer sized writes. The log can be decoded either on the target device or using a external debugger.
This comes at a cost. In particular it imposes some significant restrictions on formatting compared to typical printf() influenced logging tools.
void mlog | ( | const char * | fmt, |
... | |||
) |
Log a message.
In order to log a message mlog() captures the format string and up to three variadic arguments. It will not format the output during logging and as a result has an extremely low runtime overhead.
Some limitations arise as a result of deferring the string formatting. In particular:
If you do not understand #3 above, don't worry too much! The problems do not affect x86_64 systems.
void mlog_dump | ( | FILE * | f | ) |
char* mlog_get_line | ( | int | n | ) |
void mlog_nice | ( | const char * | fmt, |
... | |||
) |
void vmlog | ( | const char * | fmt, |
va_list | ap | ||
) |