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.
 
 
 

41 lines
1.8 KiB

#pragma once
#include "zaf_basic.h"
#include "zaf_delay.h"
extern bool g_xs_enable_log;
#define ZLOG_RELEASE(TAG, fmt, ...) \
if (g_xs_enable_log) { \
zaf_log(TAG "" fmt "\n", ##__VA_ARGS__); \
}
#define ZLOGI(TAG, fmt, ...) \
if (g_xs_enable_log) { \
zaf_log("%08lu INFO [%-8s] " fmt "\n", zaf_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZLOGD(TAG, fmt, ...) \
if (g_xs_enable_log) { \
zaf_log("%08lu DEBU [%-8s] " fmt "\n", zaf_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZLOGE(TAG, fmt, ...) \
if (g_xs_enable_log) { \
zaf_log("%08lu ERRO [%-8s] " fmt "\n", zaf_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZLOGW(TAG, fmt, ...) \
if (g_xs_enable_log) { \
zaf_log("%08lu WARN [%-8s] " fmt "\n", zaf_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ASSERT(cond) \
if (!(cond)) { \
while (1) { \
zaf_log("ASSERT: %s [%s:%d]\n", #cond, __FILE__, __LINE__); \
zaf_delay_ms(1000); \
} \
}
#define ZASSERT(cond) ASSERT(cond)
#define ZARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
void zaf_log(const char* fmt, ...);
void zaf_log_enable(bool enable);