Library for serial logging via macros.
A simple library for logging to a USB serial connection using macros.
Example usage
#include "mbed.h" #define LOG_LEVEL_INFO #include "logger.h" SerialLogger logger; int main() { logger.start(); INFO("Logging at info level."); }
Log levels
This library supports five log levels: TRACE, DEBUG, INFO, WARN and ERROR.
Log levels are hierarchical (in the order given above) meaning that when a given level is enabled all levels below are enabled. For example:
#define LOG_LEVEL_TRACE
Will enable all levels since trace is at the top of the hierarchy, where as:
#define LOG_LEVEL_WARN
Will enable from WARN down (WARN and ERROR). If no log level is defined then no logging is performed at all and the logging code can remain in place with no impact on performance. This hierarchy means that the any performance hit of writing data down a serial line can be reduced to differing levels during development and removed entirely in production by not specifying a log level.
History
Changed name of level macros
2015-08-18, by ollie8 [Tue, 18 Aug 2015 13:50:23 +0000] rev 2
Changed name of level macros
Baud rate can now be passed into start method
2015-08-18, by ollie8 [Tue, 18 Aug 2015 11:48:16 +0000] rev 1
Baud rate can now be passed into start method
First commit of logger library
2015-08-18, by ollie8 [Tue, 18 Aug 2015 11:43:40 +0000] rev 0
First commit of logger library