[rtdbg] Change all level sequence. The most urgent log level (error) using 0.

This commit is contained in:
armink 2018-09-11 18:26:28 +08:00
parent 3dea90eaf9
commit aa8ff55bbb
1 changed files with 12 additions and 12 deletions

View File

@ -54,10 +54,10 @@
#include <rtconfig.h> #include <rtconfig.h>
/* DEBUG level */ /* DEBUG level */
#define DBG_LOG 0 #define DBG_ERROR 0
#define DBG_INFO 1 #define DBG_WARNING 1
#define DBG_WARNING 2 #define DBG_INFO 2
#define DBG_ERROR 3 #define DBG_LOG 3
#ifndef DBG_SECTION_NAME #ifndef DBG_SECTION_NAME
#define DBG_SECTION_NAME "DBG" #define DBG_SECTION_NAME "DBG"
@ -98,7 +98,7 @@
* static debug routine * static debug routine
*/ */
#define dbg_log(level, fmt, ...) \ #define dbg_log(level, fmt, ...) \
if ((level) >= DBG_LEVEL) \ if ((level) <= DBG_LEVEL) \
{ \ { \
switch(level) \ switch(level) \
{ \ { \
@ -113,13 +113,13 @@
} }
#define dbg_here \ #define dbg_here \
if ((DBG_LEVEL) >= DBG_LOG){ \ if ((DBG_LEVEL) <= DBG_LOG){ \
rt_kprintf(DBG_SECTION_NAME " Here %s:%d\n", \ rt_kprintf(DBG_SECTION_NAME " Here %s:%d\n", \
__FUNCTION__, __LINE__); \ __FUNCTION__, __LINE__); \
} }
#define dbg_enter \ #define dbg_enter \
if ((DBG_LEVEL) >= DBG_LOG){ \ if ((DBG_LEVEL) <= DBG_LOG){ \
_DBG_COLOR(32); \ _DBG_COLOR(32); \
rt_kprintf(DBG_SECTION_NAME " Enter %s\n", \ rt_kprintf(DBG_SECTION_NAME " Enter %s\n", \
__FUNCTION__); \ __FUNCTION__); \
@ -127,7 +127,7 @@
} }
#define dbg_exit \ #define dbg_exit \
if ((DBG_LEVEL) >= DBG_LOG){ \ if ((DBG_LEVEL) <= DBG_LOG){ \
_DBG_COLOR(32); \ _DBG_COLOR(32); \
rt_kprintf(DBG_SECTION_NAME " Exit %s:%d\n", \ rt_kprintf(DBG_SECTION_NAME " Exit %s:%d\n", \
__FUNCTION__); \ __FUNCTION__); \
@ -155,25 +155,25 @@
#define dbg_raw(...) #define dbg_raw(...)
#endif /* DBG_ENABLE */ #endif /* DBG_ENABLE */
#if (DBG_LEVEL <= DBG_LOG) #if (DBG_LEVEL >= DBG_LOG)
#define LOG_D(fmt, ...) dbg_log_line("D", 0, fmt, ##__VA_ARGS__) #define LOG_D(fmt, ...) dbg_log_line("D", 0, fmt, ##__VA_ARGS__)
#else #else
#define LOG_D(...) #define LOG_D(...)
#endif #endif
#if (DBG_LEVEL <= DBG_INFO) #if (DBG_LEVEL >= DBG_INFO)
#define LOG_I(fmt, ...) dbg_log_line("I", 32, fmt, ##__VA_ARGS__) #define LOG_I(fmt, ...) dbg_log_line("I", 32, fmt, ##__VA_ARGS__)
#else #else
#define LOG_I(...) #define LOG_I(...)
#endif #endif
#if (DBG_LEVEL <= DBG_WARNING) #if (DBG_LEVEL >= DBG_WARNING)
#define LOG_W(fmt, ...) dbg_log_line("W", 33, fmt, ##__VA_ARGS__) #define LOG_W(fmt, ...) dbg_log_line("W", 33, fmt, ##__VA_ARGS__)
#else #else
#define LOG_W(...) #define LOG_W(...)
#endif #endif
#if (DBG_LEVEL <= DBG_ERROR) #if (DBG_LEVEL >= DBG_ERROR)
#define LOG_E(fmt, ...) dbg_log_line("E", 31, fmt, ##__VA_ARGS__) #define LOG_E(fmt, ...) dbg_log_line("E", 31, fmt, ##__VA_ARGS__)
#else #else
#define LOG_E(...) #define LOG_E(...)