整理代码。

Signed-off-by: rick.chan <cy@haoan119.com>
This commit is contained in:
rick.chan 2024-05-30 11:07:35 +08:00
parent 295ed0aa62
commit 0e6fef12c2
1 changed files with 12 additions and 12 deletions

View File

@ -34,9 +34,9 @@
#if (LOG_LEVEL<=LOG_ERR) #if (LOG_LEVEL<=LOG_ERR)
#define ELog(tag, ...) printf("[ERR|"#tag "] " __VA_ARGS__) #define ELog(tag, ...) printf("[ERR|"#tag "] " __VA_ARGS__)
#else // !(LOG_LEVEL<LOG_WAR) #else // !(LOG_LEVEL<LOG_ERR)
#define ELog(tag, ...) #define ELog(tag, ...)
#endif // (LOG_LEVEL<LOG_WAR) #endif // (LOG_LEVEL<LOG_ERR)
``` ```
## C++ 带类和函数的扩展版 ## C++ 带类和函数的扩展版
@ -52,34 +52,34 @@
#define LOG_LEVEL LOG_DBG #define LOG_LEVEL LOG_DBG
#if (LOG_LEVEL<=LOG_DBG) #if (LOG_LEVEL<=LOG_DBG)
#define DLog0(fmt) printf("[DBG|%s]" fmt, __PRETTY_FUNCTION__) #define DMsg(msg) printf("[DBG|%s]" msg, __PRETTY_FUNCTION__)
#define DLog(fmt, ...) printf("[DBG|%s]" fmt, __PRETTY_FUNCTION__, __VA_ARGS__) #define DLog(fmt, ...) printf("[DBG|%s]" fmt, __PRETTY_FUNCTION__, __VA_ARGS__)
#else // !(LOG_LEVEL<LOG_DBG) #else // !(LOG_LEVEL<LOG_DBG)
#define DLog0(fmt) #define DMsg(msg)
#define DLog(fmt, ...) #define DLog(fmt, ...)
#endif // (LOG_LEVEL<LOG_DBG) #endif // (LOG_LEVEL<LOG_DBG)
#if (LOG_LEVEL<=LOG_INF) #if (LOG_LEVEL<=LOG_INF)
#define ILog0(fmt) printf("[INF|%s]" fmt, __PRETTY_FUNCTION__) #define IMsg(msg) printf("[INF|%s]" msg, __PRETTY_FUNCTION__)
#define ILog(fmt, ...) printf("[INF|%s]" fmt, __PRETTY_FUNCTION__, __VA_ARGS__) #define ILog(fmt, ...) printf("[INF|%s]" fmt, __PRETTY_FUNCTION__, __VA_ARGS__)
#else // !(LOG_LEVEL<LOG_INF) #else // !(LOG_LEVEL<LOG_INF)
#define ILog0(fmt) #define IMsg(msg)
#define ILog(fmt, ...) #define ILog(fmt, ...)
#endif // (LOG_LEVEL<LOG_INF) #endif // (LOG_LEVEL<LOG_INF)
#if (LOG_LEVEL<=LOG_WAR) #if (LOG_LEVEL<=LOG_WAR)
#define WLog0(fmt) printf("[WAR|%s]" fmt, __PRETTY_FUNCTION__) #define WMsg(msg) printf("[WAR|%s]" msg, __PRETTY_FUNCTION__)
#define WLog(fmt, ...) printf("[WAR|%s]" fmt, __PRETTY_FUNCTION__, __VA_ARGS__) #define WLog(fmt, ...) printf("[WAR|%s]" fmt, __PRETTY_FUNCTION__, __VA_ARGS__)
#else // !(LOG_LEVEL<LOG_WAR) #else // !(LOG_LEVEL<LOG_WAR)
#define WLog0(fmt) #define WMsg(msg)
#define WLog(fmt, ...) #define WLog(fmt, ...)
#endif // (LOG_LEVEL<LOG_WAR) #endif // (LOG_LEVEL<LOG_WAR)
#if (LOG_LEVEL<=LOG_ERR) #if (LOG_LEVEL<=LOG_ERR)
#define ELog0(fmt) printf("[ERR|%s]" fmt, __PRETTY_FUNCTION__) #define EMsg(msg) printf("[ERR|%s]" msg, __PRETTY_FUNCTION__)
#define ELog(fmt, ...) printf("[ERR|%s]" fmt, __PRETTY_FUNCTION__, __VA_ARGS__) #define ELog(fmt, ...) printf("[ERR|%s]" fmt, __PRETTY_FUNCTION__, __VA_ARGS__)
#else // !(LOG_LEVEL<LOG_WAR) #else // !(LOG_LEVEL<LOG_ERR)
#define ELog0(fmt) #define EMsg(msg)
#define ELog(fmt, ...) #define ELog(fmt, ...)
#endif // (LOG_LEVEL<LOG_WAR) #endif // (LOG_LEVEL<LOG_ERR)
``` ```