15 #define MONITOR_DBG_ERROR 0
16 #define MONITOR_DBG_WARNING 1
17 #define MONITOR_DBG_INFO 2
18 #define MONITOR_DBG_LOG 3
20 #ifndef MONITOR_DBG_TAG
21 #define MONITOR_DBG_TAG "MONITOR"
35 #ifdef CONFIG_MONITOR_PRINTF_COLOR_ENABLE
36 #define _MONITOR_DBG_COLOR(n) CONFIG_MONITOR_PRINTF("\033[" #n "m")
37 #define _MONITOR_DBG_LOG_HDR(lvl_name, color_n) \
38 CONFIG_MONITOR_PRINTF("\033[" #color_n "m[" lvl_name "/" MONITOR_DBG_TAG "] ")
39 #define _MONITOR_DBG_LOG_X_END \
40 CONFIG_MONITOR_PRINTF("\033[0m")
42 #define _MONITOR_DBG_COLOR(n)
43 #define _MONITOR_DBG_LOG_HDR(lvl_name, color_n) \
44 CONFIG_MONITOR_PRINTF("[" lvl_name "/" MONITOR_DBG_TAG "] ")
45 #define _MONITOR_DBG_LOG_X_END
48 #define monitor_dbg_log_line(lvl, color_n, fmt, ...) \
50 _MONITOR_DBG_LOG_HDR(lvl, color_n); \
51 CONFIG_MONITOR_PRINTF(fmt, ##__VA_ARGS__); \
52 _MONITOR_DBG_LOG_X_END; \
55 #if (CONFIG_MONITOR_DBG_LEVEL >= MONITOR_DBG_LOG)
56 #define MONITOR_LOG_DBG(fmt, ...) monitor_dbg_log_line("D", 0, fmt, ##__VA_ARGS__)
58 #define MONITOR_LOG_DBG(...)
61 #if (CONFIG_MONITOR_DBG_LEVEL >= MONITOR_DBG_INFO)
62 #define MONITOR_LOG_INFO(fmt, ...) monitor_dbg_log_line("I", 32, fmt, ##__VA_ARGS__)
64 #define MONITOR_LOG_INFO(...)
67 #if (CONFIG_MONITOR_DBG_LEVEL >= MONITOR_DBG_WARNING)
68 #define MONITOR_LOG_WRN(fmt, ...) monitor_dbg_log_line("W", 33, fmt, ##__VA_ARGS__)
70 #define MONITOR_LOG_WRN(...)
73 #if (CONFIG_MONITOR_DBG_LEVEL >= MONITOR_DBG_ERROR)
74 #define MONITOR_LOG_ERR(fmt, ...) monitor_dbg_log_line("E", 31, fmt, ##__VA_ARGS__)
76 #define MONITOR_LOG_ERR(...)
79 #if (CONFIG_MONITOR_DBG_LEVEL >= MONITOR_DBG_LOG)
80 #define MONITOR_LOG_RAW(...) CONFIG_MONITOR_PRINTF(__VA_ARGS__)
82 #define MONITOR_LOG_RAW(...)