summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2019-03-07 17:03:23 +0800
committerGitHub <[email protected]>2019-03-07 17:03:23 +0800
commitce2cbb42ecb7f9633b648060708a13d0f478ef7c (patch)
tree74c842d5da03de26d3e6b7399dc32eaaff86c4fa /include
parenta041f768a663120a43c41b19148e40df3e78f0d2 (diff)
parent4f7c06f9232d30e768c1fd4925414e446e4ca585 (diff)
Merge pull request #2388 from armink/fix_rtdbg
Remove the DBG_COLOR and DBG_ENABLE definition.
Diffstat (limited to 'include')
-rw-r--r--include/rtdbg.h33
1 files changed, 11 insertions, 22 deletions
diff --git a/include/rtdbg.h b/include/rtdbg.h
index 9036a0cd66..6eb8ceb221 100644
--- a/include/rtdbg.h
+++ b/include/rtdbg.h
@@ -19,16 +19,12 @@
* header file.
*
* #define DBG_SECTION_NAME "MOD"
- * #define DBG_ENABLE // enable debug macro
* #define DBG_LEVEL DBG_INFO
- * #include <rtdbg.h> // must after of DEBUG_ENABLE or some other options
+ * #include <rtdbg.h> // must after of DBG_LEVEL, DBG_SECTION_NAME or other options
*
* Then in your C/C++ file, you can use LOG_X macro to print out logs:
* LOG_D("this is a debug log!");
* LOG_E("this is a error log!");
- *
- * If you want to use different color for different kinds log, you can
- * #define DBG_COLOR
*/
#ifndef RT_DBG_H__
@@ -36,6 +32,16 @@
#include <rtconfig.h>
+/* the debug log will force enable when RT_DEBUG macro is defined */
+#if defined(RT_DEBUG) && !defined(DBG_ENABLE)
+#define DBG_ENABLE
+#endif
+
+/* it will force output color log when RT_DEBUG_COLOR macro is defined */
+#if defined(RT_DEBUG_COLOR) && !defined(DBG_COLOR)
+#define DBG_COLOR
+#endif
+
#if defined(RT_USING_ULOG) && defined(DBG_ENABLE)
/* using ulog compatible with rtdbg */
#include <ulog.h>
@@ -108,23 +114,6 @@
__FUNCTION__, __LINE__); \
}
-#define dbg_enter \
- if ((DBG_LEVEL) <= DBG_LOG){ \
- _DBG_COLOR(32); \
- rt_kprintf(DBG_SECTION_NAME " Enter %s\n", \
- __FUNCTION__); \
- _DBG_COLOR(0); \
- }
-
-#define dbg_exit \
- if ((DBG_LEVEL) <= DBG_LOG){ \
- _DBG_COLOR(32); \
- rt_kprintf(DBG_SECTION_NAME " Exit %s:%d\n", \
- __FUNCTION__); \
- _DBG_COLOR(0); \
- }
-
-
#define dbg_log_line(lvl, color_n, fmt, ...) \
do \
{ \