Logger library provides an output stream for debugging information.
To use this library
The library provides functionality to write debugging information for several different severity levels (info, debug, warning, error and fatal), which can be configured. The library uses the UART driver for output stream.
Logger library is usually initialized on application start-up, before any logging. The library initializes UART driver on configured pins. Example initialization procedure is shown below:
static log_t log; log_cfg_t cfg; LOG_MAP_USB_UART(cfg); cfg.level = LOG_LEVEL_DEBUG; log_init(&log, &cfg);
The library has a log function for each severity level. To write a log message to output, simply call the log function for the desired severity level, as shown in the following example:
log_debug(&log, "This is a debug message!");
The output message is formatted as:
[DEBUG]: This is a debug message!