![]() |
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 | Flush_Log() |
| #define | LOG_INIT() |
| #define | DEBUG_LOG_MAX_LEVEL LVL_ERROR |
| #define | LVL_DEBUG 4 |
| Macros to define several log levels: Debug, Info, Warning, Error. | |
| #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. | |
| #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 | S_LINEENDING "\n" |
| #define | LOG(level, fmt, ...) |
| Print a log message if its severity is lower or equal to DEBUG_LOG_MAX_LEVEL. | |
| #define | LOGE(fmt, ...) LOG(LVL_ERROR, fmt __VA_OPT__(,) __VA_ARGS__) |
| Set of macros that avoid to pass the full log level. | |
| #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. | |
| #define | LOG_FLUSH(level) |
| Actively wait that Uart buffer as been sent. | |
| #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 103 of file debug_log.h.
| #define DEBUG_LOG_PRINT_LEVEL |
Definition at line 142 of file debug_log.h.
| #define DEBUG_LOG_PRINT_MODULE_NAME |
Definition at line 140 of file debug_log.h.
| #define DEBUG_LOG_PRINT_TIME |
Definition at line 141 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 127 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 132 of file debug_log.h.
| #define Flush_Log | ( | ) |
Definition at line 90 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 206 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 239 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 259 of file debug_log.h.
| #define LOG_INIT | ( | ) |
Definition at line 91 of file debug_log.h.
Definition at line 227 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 224 of file debug_log.h.
Definition at line 226 of file debug_log.h.
| #define LOGW | ( | fmt, | |
| ... | |||
| ) | LOG(LVL_WARNING, fmt __VA_OPT__(,) __VA_ARGS__) |
Definition at line 225 of file debug_log.h.
| #define LVL_DEBUG 4 |
Macros to define several log levels: Debug, Info, Warning, Error.
Definition at line 109 of file debug_log.h.
| #define LVL_ERROR 1 |
Definition at line 112 of file debug_log.h.
| #define LVL_INFO 3 |
Definition at line 110 of file debug_log.h.
| #define LVL_NOLOG 0 |
Definition at line 113 of file debug_log.h.
| #define LVL_STRING_0 "" |
Definition at line 122 of file debug_log.h.
| #define LVL_STRING_1 "E" |
Definition at line 121 of file debug_log.h.
| #define LVL_STRING_2 "W" |
Definition at line 120 of file debug_log.h.
| #define LVL_STRING_3 "I" |
Definition at line 119 of file debug_log.h.
| #define LVL_STRING_4 "D" |
Definition at line 118 of file debug_log.h.
| #define LVL_WARNING 2 |
Definition at line 111 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 89 of file debug_log.h.
| #define S_FUNCTION_PREFIX |
Definition at line 178 of file debug_log.h.
| #define S_FUNCTION_SUFFIX |
Definition at line 179 of file debug_log.h.
| #define S_LEVEL_PREFIX | ( | level | ) | " "DEBUG_LVL_TO_STRING(level)": " |
Definition at line 169 of file debug_log.h.
| #define S_LINE_PREFIX |
Definition at line 186 of file debug_log.h.
| #define S_LINE_SUFFIX |
Definition at line 187 of file debug_log.h.
| #define S_LINEENDING "\n" |
Definition at line 193 of file debug_log.h.
| #define S_MOD_NAME_PREFIX "["DEBUG_LOG_MODULE_NAME"]" |
Definition at line 149 of file debug_log.h.
| #define S_TIME_PREFIX "[%09u]" |
Definition at line 161 of file debug_log.h.
| #define S_TIME_SUFFIX , lib_time->getTimestampCoarse() |
Definition at line 162 of file debug_log.h.