Hopefully useful: macro-controlled logger
Eric McCorkle
eric at metricspace.net
Sat Dec 9 16:52:12 UTC 2017
Hi folks,
At some point in the past, I recall reading about a log4j-inspired
logging API for C that used the preprocessor to avoid introducing
runtime overhead. However, I've never been able to find this library,
so I've used my own scrappy macro collection over the years.
Anyway, on a recent flight I decided to implement a macro-controlled
logging API in earnest.
The github project can be found here: https://github.com/emc2/mcl
It provides the ability to define module-specific loggers, log at
different levels, and set a threshold for dynamically-controlled logging
levels. Any log message more severe than the dynamic range will be
hardwired in place, and any message less severe will be removed at
compilation time.
It's not large or complicated at all, but hopefully someone will find it
useful. If they do, I'd be more than happy to have it added to the
FreeBSD base system.
More information about the freebsd-hackers
mailing list