[rtdbg] Update dbg log header format.
This commit is contained in:
parent
9ec76e302d
commit
541925195f
|
@ -32,7 +32,7 @@
|
||||||
* In your C/C++ file, enable/disable DEBUG_ENABLE macro, and then include this
|
* In your C/C++ file, enable/disable DEBUG_ENABLE macro, and then include this
|
||||||
* header file.
|
* header file.
|
||||||
*
|
*
|
||||||
* #define DBG_SECTION_NAME "[ MOD]"
|
* #define DBG_SECTION_NAME "MOD"
|
||||||
* #define DBG_ENABLE // enable debug macro
|
* #define DBG_ENABLE // enable debug macro
|
||||||
* #define DBG_LEVEL DBG_INFO
|
* #define DBG_LEVEL DBG_INFO
|
||||||
* #include <rtdbg.h> // must after of DEBUG_ENABLE or some other options
|
* #include <rtdbg.h> // must after of DEBUG_ENABLE or some other options
|
||||||
|
@ -82,9 +82,13 @@
|
||||||
*/
|
*/
|
||||||
#ifdef DBG_COLOR
|
#ifdef DBG_COLOR
|
||||||
#define _DBG_COLOR(n) rt_kprintf("\033["#n"m")
|
#define _DBG_COLOR(n) rt_kprintf("\033["#n"m")
|
||||||
|
#define _DBG_LOG_HDR(lvl_name, color_n) \
|
||||||
|
rt_kprintf("\033["#color_n"m["lvl_name"/"DBG_SECTION_NAME"] ")
|
||||||
#else
|
#else
|
||||||
#define _DBG_COLOR(n)
|
#define _DBG_COLOR(n)
|
||||||
#endif
|
#define _DBG_LOG_HDR(lvl_name, color_n) \
|
||||||
|
rt_kprintf("["lvl_name"/"DBG_SECTION_NAME"] ")
|
||||||
|
#endif /* DBG_COLOR */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static debug routine
|
* static debug routine
|
||||||
|
@ -94,12 +98,13 @@
|
||||||
{ \
|
{ \
|
||||||
switch(level) \
|
switch(level) \
|
||||||
{ \
|
{ \
|
||||||
case DBG_ERROR: _DBG_COLOR(31); break; \
|
case DBG_ERROR: _DBG_LOG_HDR("E", 31); break; \
|
||||||
case DBG_WARNING: _DBG_COLOR(33); break; \
|
case DBG_WARNING: _DBG_LOG_HDR("W", 33); break; \
|
||||||
case DBG_INFO: _DBG_COLOR(32); break; \
|
case DBG_INFO: _DBG_LOG_HDR("I", 32); break; \
|
||||||
|
case DBG_LOG: _DBG_LOG_HDR("D", 0); break; \
|
||||||
default: break; \
|
default: break; \
|
||||||
} \
|
} \
|
||||||
rt_kprintf(DBG_SECTION_NAME fmt, ##__VA_ARGS__); \
|
rt_kprintf(fmt, ##__VA_ARGS__); \
|
||||||
_DBG_COLOR(0); \
|
_DBG_COLOR(0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue