openwsn_log.h File Reference

System logging header OpenWSN definitions. More...

Detailed Description

System logging header OpenWSN definitions.

This header implements the same functionality as log.h but avoiding macro redefinitions with OpenWSN LOG_% functions.

Kaspar Schleiser

Definition in file openwsn_log.h.

Go to the source code of this file.


#define log_write(level, ...)   printf(__VA_ARGS__)
 Default log_write function, just maps to printf. More...
 Default log level define. More...
#define LOG(level, ...)
 Log message if level <= LOG_LEVEL. More...
enum  {
 defined log levels More...

Logging convenience defines

#define LOG_RIOT_INFO(...)   LOG(LOG_INFO, __VA_ARGS__)

Macro Definition Documentation


#define LOG (   level,
do { \
if ((level) <= LOG_LEVEL) log_write((level), __VA_ARGS__); } while (0U)
#define LOG_LEVEL
Default log level define.
Definition: openwsn_log.h:60
#define log_write(level,...)
Default log_write function, just maps to printf.
Definition: openwsn_log.h:90

Log message if level <= LOG_LEVEL.

Definition at line 73 of file openwsn_log.h.



Default log level define.

Definition at line 60 of file openwsn_log.h.


#define LOG_RIOT_DEBUG (   ...)    LOG(LOG_DEBUG, __VA_ARGS__)

Definition at line 84 of file openwsn_log.h.


#define LOG_RIOT_ERROR (   ...)    LOG(LOG_ERROR, __VA_ARGS__)

Definition at line 81 of file openwsn_log.h.


#define LOG_RIOT_INFO (   ...)    LOG(LOG_INFO, __VA_ARGS__)

Definition at line 83 of file openwsn_log.h.


#define LOG_RIOT_WARNING (   ...)    LOG(LOG_WARNING, __VA_ARGS__)

Definition at line 82 of file openwsn_log.h.

◆ log_write

#define log_write (   level,
)    printf(__VA_ARGS__)

Default log_write function, just maps to printf.

Definition at line 90 of file openwsn_log.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

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.


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.


print everything

Definition at line 41 of file openwsn_log.h.