You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
2.0 KiB
43 lines
2.0 KiB
#pragma once
|
|
#include "xs_basic.h"
|
|
#include "xs_delay.h"
|
|
|
|
extern bool g_xs_enable_log;
|
|
#define XS_LOG_RELEASE(TAG, fmt, ...) \
|
|
if (g_xs_enable_log) { \
|
|
xs_log(TAG "" fmt "\n", ##__VA_ARGS__); \
|
|
}
|
|
#define XS_LOGI(TAG, fmt, ...) \
|
|
if (g_xs_enable_log) { \
|
|
xs_log("%08lu INFO [%-8s] " fmt "\n", xs_get_ticket(), TAG, ##__VA_ARGS__); \
|
|
}
|
|
#define XS_LOGD(TAG, fmt, ...) \
|
|
if (g_xs_enable_log) { \
|
|
xs_log("%08lu DEBU [%-8s] " fmt "\n", xs_get_ticket(), TAG, ##__VA_ARGS__); \
|
|
}
|
|
#define XS_LOGE(TAG, fmt, ...) \
|
|
if (g_xs_enable_log) { \
|
|
xs_log("%08lu ERRO [%-8s] " fmt "\n", xs_get_ticket(), TAG, ##__VA_ARGS__); \
|
|
}
|
|
|
|
#define XS_LOGW(TAG, fmt, ...) \
|
|
if (g_xs_enable_log) { \
|
|
xs_log("%08lu WARN [%-8s] " fmt "\n", xs_get_ticket(), TAG, ##__VA_ARGS__); \
|
|
}
|
|
|
|
#define XS_ASSERT(cond) \
|
|
if (!(cond)) { \
|
|
while (1) { \
|
|
xs_log("ASSERT: %s [%s:%d]\n", #cond, __FILE__, __LINE__); \
|
|
xs_delay_ms(1000); \
|
|
} \
|
|
}
|
|
|
|
#define ZLOGI(TAG, fmt, ...) XS_LOGI(TAG, fmt, ##__VA_ARGS__)
|
|
#define ZLOGD(TAG, fmt, ...) XS_LOGD(TAG, fmt, ##__VA_ARGS__)
|
|
#define ZLOGE(TAG, fmt, ...) XS_LOGE(TAG, fmt, ##__VA_ARGS__)
|
|
#define ZLOGW(TAG, fmt, ...) XS_LOGW(TAG, fmt, ##__VA_ARGS__)
|
|
#define ZASSERT(cond) XS_ASSERT(cond)
|
|
|
|
void xs_log(const char* fmt, ...);
|
|
void xs_log_enable(bool enable);
|