|
|
@ -5,29 +5,29 @@ |
|
|
|
#include "cmsis_os.h" |
|
|
|
#include "main.h" |
|
|
|
extern bool g_enable_log; |
|
|
|
#define ZLOG_RELEASE(TAG, fmt, ...) \ |
|
|
|
#define ZLOG_RELEASE(TAG, fmt, ...) \ |
|
|
|
if (g_enable_log) { \ |
|
|
|
zlog(TAG "" fmt "\n", ##__VA_ARGS__); \ |
|
|
|
} |
|
|
|
#define ZLOGI(TAG, fmt, ...) \ |
|
|
|
#define ZLOGI(TAG, fmt, ...) \ |
|
|
|
if (g_enable_log) { \ |
|
|
|
zlog("%08lu INFO [%-8s] " fmt "\n", HAL_GetTick(), TAG, ##__VA_ARGS__); \ |
|
|
|
} |
|
|
|
#define ZLOGD(TAG, fmt, ...) \ |
|
|
|
#define ZLOGD(TAG, fmt, ...) \ |
|
|
|
if (g_enable_log) { \ |
|
|
|
zlog("%08lu DEBU [%-8s] " fmt "\n", HAL_GetTick(), TAG, ##__VA_ARGS__); \ |
|
|
|
} |
|
|
|
#define ZLOGE(TAG, fmt, ...) \ |
|
|
|
#define ZLOGE(TAG, fmt, ...) \ |
|
|
|
if (g_enable_log) { \ |
|
|
|
zlog("%08lu ERRO [%-8s] " fmt "\n", HAL_GetTick(), TAG, ##__VA_ARGS__); \ |
|
|
|
} |
|
|
|
|
|
|
|
#define ZLOGW(TAG, fmt, ...) \ |
|
|
|
#define ZLOGW(TAG, fmt, ...) \ |
|
|
|
if (g_enable_log) { \ |
|
|
|
zlog("%08lu WARN [%-8s] " fmt "\n", HAL_GetTick(), TAG, ##__VA_ARGS__); \ |
|
|
|
} |
|
|
|
|
|
|
|
#define ZASSERT(cond) \ |
|
|
|
#define ZASSERT(cond) \ |
|
|
|
if (!(cond)) { \ |
|
|
|
while (1) { \ |
|
|
|
zlog("ASSERT: %s [%s:%d]\n", #cond, __FILE__, __LINE__); \ |
|
|
@ -35,12 +35,18 @@ extern bool g_enable_log; |
|
|
|
} \ |
|
|
|
} |
|
|
|
|
|
|
|
#define ZASSERT_INFO(cond, info) \ |
|
|
|
if (!(cond)) { \ |
|
|
|
while (1) { \ |
|
|
|
#define ZASSERT_INFO(cond, info) \ |
|
|
|
if (!(cond)) { \ |
|
|
|
while (1) { \ |
|
|
|
zlog("ASSERT: %s [%s:%d] %s\n", #cond, __FILE__, __LINE__, info); \ |
|
|
|
osDelay(1000); \ |
|
|
|
} \ |
|
|
|
osDelay(1000); \ |
|
|
|
} \ |
|
|
|
} |
|
|
|
|
|
|
|
#define ZEARLY_ASSERT(cond) \ |
|
|
|
if (!(cond)) { \ |
|
|
|
while (1) { \ |
|
|
|
} \ |
|
|
|
} |
|
|
|
|
|
|
|
void zlog(const char* fmt, ...); |
|
|
|