![]()  | 
        
           Wirepas SDK
           
         | 
        
Helper file to print debug logs.
Definition in file debug_log.h.
Go to the source code of this file.
Macros | |
| #define | Print_Log(fmt, ...) | 
| #define | LOG_INIT() | 
| #define | DEBUG_LOG_MAX_LEVEL LVL_ERROR | 
| #define | LVL_DEBUG 4 | 
| Macros to define several log levels: Debug, Info, Warning, Error.  More... | |
| #define | LVL_INFO 3 | 
| #define | LVL_WARNING 2 | 
| #define | LVL_ERROR 1 | 
| #define | LVL_NOLOG 0 | 
| #define | LVL_STRING_4 "D" | 
| #define | LVL_STRING_3 "I" | 
| #define | LVL_STRING_2 "W" | 
| #define | LVL_STRING_1 "E" | 
| #define | LVL_STRING_0 "" | 
| #define | DEBUG_LVL_TO_STRING(level) LVL_STRING_##level | 
| Macro to retrieve a string from the log level.  More... | |
| #define | FLUSH_DELAY_MS 45 | 
| #define | DEBUG_LOG_PRINT_MODULE_NAME | 
| #define | DEBUG_LOG_PRINT_TIME | 
| #define | DEBUG_LOG_PRINT_LEVEL | 
| #define | S_MOD_NAME_PREFIX "["DEBUG_LOG_MODULE_NAME"]" | 
| #define | S_TIME_PREFIX "[%09u]" | 
| #define | S_TIME_SUFFIX , lib_time->getTimestampCoarse() | 
| #define | S_LEVEL_PREFIX(level) " "DEBUG_LVL_TO_STRING(level)": " | 
| #define | S_FUNCTION_PREFIX | 
| #define | S_FUNCTION_SUFFIX | 
| #define | S_LINE_PREFIX | 
| #define | S_LINE_SUFFIX | 
| #define | LOG(level, fmt, ...) | 
| Print a log message if its severity is lower or equal to DEBUG_LOG_MAX_LEVEL.  More... | |
| #define | LOGE(fmt, ...) LOG(LVL_ERROR, fmt __VA_OPT__(,) __VA_ARGS__) | 
| Set of macros that avoid to pass the full log level.  More... | |
| #define | LOGW(fmt, ...) LOG(LVL_WARNING, fmt __VA_OPT__(,) __VA_ARGS__) | 
| #define | LOGI(fmt, ...) LOG(LVL_INFO, fmt __VA_OPT__(,) __VA_ARGS__) | 
| #define | LOGD(fmt, ...) LOG(LVL_DEBUG, fmt __VA_OPT__(,) __VA_ARGS__) | 
| #define | LOG_BUFFER(level, buffer, size) | 
| Print a buffer if its severity is lower or equal to DEBUG_LOG_MAX_LEVEL.  More... | |
| #define | LOG_FLUSH(level) | 
| Actively wait that Uart buffer as been sent.  More... | |
| #define DEBUG_LOG_MAX_LEVEL LVL_ERROR | 
Only logs with a level lower or equal to DEBUG_LOG_MAX_LEVEL will be printed
Definition at line 76 of file debug_log.h.
| #define DEBUG_LOG_PRINT_LEVEL | 
Definition at line 115 of file debug_log.h.
| #define DEBUG_LOG_PRINT_MODULE_NAME | 
Definition at line 113 of file debug_log.h.
| #define DEBUG_LOG_PRINT_TIME | 
Definition at line 114 of file debug_log.h.
| #define DEBUG_LVL_TO_STRING | ( | level | ) | LVL_STRING_##level | 
Macro to retrieve a string from the log level.
Definition at line 100 of file debug_log.h.
| #define FLUSH_DELAY_MS 45 | 
Time to flush Usart buffer in ms (buffer is 512 bytes, so ~45ms to flush full buffer).
Definition at line 105 of file debug_log.h.
| #define LOG | ( | level, | |
| fmt, | |||
| ... | |||
| ) | 
Print a log message if its severity is lower or equal to DEBUG_LOG_MAX_LEVEL.
| level | Severity of the log. | 
| fmt | Format of the log | 
| ... | The list of parameters | 
Definition at line 173 of file debug_log.h.
| #define LOG_BUFFER | ( | level, | |
| buffer, | |||
| size | |||
| ) | 
Print a buffer if its severity is lower or equal to DEBUG_LOG_MAX_LEVEL.
| level | Severity of the log. | 
| buffer | Pointer to the buffer to print. | 
| size | Size in bytes of the buffer. | 
Definition at line 206 of file debug_log.h.
| #define LOG_FLUSH | ( | level | ) | 
Actively wait that Uart buffer as been sent.
| level | Only wait if level is lower or equal to DEBUG_LOG_MAX_LEVEL. | 
Definition at line 226 of file debug_log.h.
| #define LOG_INIT | ( | ) | 
Definition at line 66 of file debug_log.h.
Definition at line 194 of file debug_log.h.
Set of macros that avoid to pass the full log level.
| fmt | Format of the log | 
| ... | The list of parameters | 
Definition at line 191 of file debug_log.h.
Definition at line 193 of file debug_log.h.
| #define LOGW | ( | fmt, | |
| ... | |||
| ) | LOG(LVL_WARNING, fmt __VA_OPT__(,) __VA_ARGS__) | 
Definition at line 192 of file debug_log.h.
| #define LVL_DEBUG 4 | 
Macros to define several log levels: Debug, Info, Warning, Error.
Definition at line 82 of file debug_log.h.
| #define LVL_ERROR 1 | 
Definition at line 85 of file debug_log.h.
| #define LVL_INFO 3 | 
Definition at line 83 of file debug_log.h.
| #define LVL_NOLOG 0 | 
Definition at line 86 of file debug_log.h.
| #define LVL_STRING_0 "" | 
Definition at line 95 of file debug_log.h.
| #define LVL_STRING_1 "E" | 
Definition at line 94 of file debug_log.h.
| #define LVL_STRING_2 "W" | 
Definition at line 93 of file debug_log.h.
| #define LVL_STRING_3 "I" | 
Definition at line 92 of file debug_log.h.
| #define LVL_STRING_4 "D" | 
Definition at line 91 of file debug_log.h.
| #define LVL_WARNING 2 | 
Definition at line 84 of file debug_log.h.
| #define Print_Log | ( | fmt, | |
| ... | |||
| ) | 
Simple library to print only relevant log messages.
APP_PRINTING=yes must be defined in the makefile of the application.
Add the following lines in each file using debug logs :
By default Module name; TimeStamp (coarse) and Debug level are printed.
By defining DEBUG_LOG_CUSTOM in the app makefile it is possible to select which debug field is printed.
Define one of the folling in the general makefile or before including "debug_log.h" to enable the corresponding field in the log message :
Usage :
Definition at line 65 of file debug_log.h.
| #define S_FUNCTION_PREFIX | 
Definition at line 151 of file debug_log.h.
| #define S_FUNCTION_SUFFIX | 
Definition at line 152 of file debug_log.h.
| #define S_LEVEL_PREFIX | ( | level | ) | " "DEBUG_LVL_TO_STRING(level)": " | 
Definition at line 142 of file debug_log.h.
| #define S_LINE_PREFIX | 
Definition at line 159 of file debug_log.h.
| #define S_LINE_SUFFIX | 
Definition at line 160 of file debug_log.h.
| #define S_MOD_NAME_PREFIX "["DEBUG_LOG_MODULE_NAME"]" | 
Definition at line 122 of file debug_log.h.
| #define S_TIME_PREFIX "[%09u]" | 
Definition at line 134 of file debug_log.h.
| #define S_TIME_SUFFIX , lib_time->getTimestampCoarse() | 
Definition at line 135 of file debug_log.h.