System Logging API¶
This API offers a bunch of
LOG_* functions that, with the default
implementation, just use printf, but honor a verbosity level.
If desired, it is possible to implement a log module which then will be used instead the default printf-based implementation. In order to do so, the log module has to
- provide “log_module.h”
- have a name starting with
log_or depend on the pseudo-module LOG,
- implement log_write()
Defined log levels.
These are the logging levels a user can choose. The idea is to set LOG_LEVEL to one of these values in the application’s Makefile. That will restrict output of log statements to those with equal or lower log level.
The default log level is LOG_INFO, which will print every message.
The log function calls of filtered messages will be optimized out at compile time, so a lower log level might result in smaller code size.
Lowest log level, will output nothing.
Error log level, will print only critical, non-recoverable errors like hardware initialization failures.
Warning log level, will print warning messages for temporary errors.
Special level for telemetry.
Informational log level, will print purely informational messages like successful system bootup, network link state, ...
Debug log level, printing developer stuff considered too verbose for production use.
LOG(level, ...) if (level <= LOG_LEVEL) log_write(level, __VA_ARGS__)¶
Log message if level <= LOG_LEVEL.
log_write(level, ...) printf(__VA_ARGS__)¶
Default log_write function, just maps to printf.