[rtdbg] Add ulog compatible with rtdbg.
This commit is contained in:
parent
e588dfa633
commit
29dd96ec35
|
@ -23,10 +23,7 @@
|
||||||
* #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
|
||||||
*
|
*
|
||||||
* Then in your C/C++ file, you can use dbg_log macro to print out logs:
|
* Then in your C/C++ file, you can use LOG_X macro to print out logs:
|
||||||
* dbg_log(DBG_INFO, "this is a log!\n");
|
|
||||||
*
|
|
||||||
* Or if you want to using the simple API, you can
|
|
||||||
* LOG_D("this is a debug log!");
|
* LOG_D("this is a debug log!");
|
||||||
* LOG_E("this is a error log!");
|
* LOG_E("this is a error log!");
|
||||||
*
|
*
|
||||||
|
@ -39,6 +36,11 @@
|
||||||
|
|
||||||
#include <rtconfig.h>
|
#include <rtconfig.h>
|
||||||
|
|
||||||
|
#if defined(RT_USING_ULOG) && defined(DBG_ENABLE)
|
||||||
|
/* using ulog compatible with rtdbg */
|
||||||
|
#include <ulog.h>
|
||||||
|
#else
|
||||||
|
|
||||||
/* DEBUG level */
|
/* DEBUG level */
|
||||||
#define DBG_ERROR 0
|
#define DBG_ERROR 0
|
||||||
#define DBG_WARNING 1
|
#define DBG_WARNING 1
|
||||||
|
@ -82,6 +84,8 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static debug routine
|
* static debug routine
|
||||||
|
* NOTE: This is a NOT RECOMMENDED API. Please using LOG_X API.
|
||||||
|
* It will be DISCARDED later. Because it will take up more resources.
|
||||||
*/
|
*/
|
||||||
#define dbg_log(level, fmt, ...) \
|
#define dbg_log(level, fmt, ...) \
|
||||||
if ((level) <= DBG_LEVEL) \
|
if ((level) <= DBG_LEVEL) \
|
||||||
|
@ -167,4 +171,6 @@
|
||||||
|
|
||||||
#define LOG_RAW(...) dbg_raw(__VA_ARGS__)
|
#define LOG_RAW(...) dbg_raw(__VA_ARGS__)
|
||||||
|
|
||||||
|
#endif /* defined(RT_USING_ULOG) && define(DBG_ENABLE) */
|
||||||
|
|
||||||
#endif /* RT_DBG_H__ */
|
#endif /* RT_DBG_H__ */
|
||||||
|
|
Loading…
Reference in New Issue