[rtdbg] Simplify the debug tag and level macro to DBG_TAG and DBG_LVL.

This commit is contained in:
armink 2019-04-12 10:17:22 +08:00
parent 16e8f34e46
commit 35bb75b96b
1 changed files with 17 additions and 3 deletions

View File

@ -18,9 +18,9 @@
* 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_TAG "MOD_TAG"
* #define DBG_LEVEL DBG_INFO * #define DBG_LVL DBG_INFO
* #include <rtdbg.h> // must after of DBG_LEVEL, DBG_SECTION_NAME or other options * #include <rtdbg.h> // must after of DBG_LVL, DBG_TAG or other options
* *
* Then in your C/C++ file, you can use LOG_X macro to print out logs: * Then in your C/C++ file, you can use LOG_X macro to print out logs:
* LOG_D("this is a debug log!"); * LOG_D("this is a debug log!");
@ -53,15 +53,29 @@
#define DBG_INFO 2 #define DBG_INFO 2
#define DBG_LOG 3 #define DBG_LOG 3
#ifdef DBG_TAG
#ifndef DBG_SECTION_NAME
#define DBG_SECTION_NAME DBG_TAG
#endif
#else
/* compatible with old version */
#ifndef DBG_SECTION_NAME #ifndef DBG_SECTION_NAME
#define DBG_SECTION_NAME "DBG" #define DBG_SECTION_NAME "DBG"
#endif #endif
#endif /* DBG_TAG */
#ifdef DBG_ENABLE #ifdef DBG_ENABLE
#ifdef DBG_LVL
#ifndef DBG_LEVEL
#define DBG_LEVEL DBG_LVL
#endif
#else
/* compatible with old version */
#ifndef DBG_LEVEL #ifndef DBG_LEVEL
#define DBG_LEVEL DBG_WARNING #define DBG_LEVEL DBG_WARNING
#endif #endif
#endif /* DBG_LVL */
/* /*
* The color for terminal (foreground) * The color for terminal (foreground)