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.
 
 

47 lines
2.2 KiB

#pragma once
#include <stdio.h>
#include "mutex.hpp"
#include "sdk\chip\basic\logger.hpp"
extern iflytop::zmutex glog_mutex;
extern "C" {
extern bool g_enable_log;
#define ZLOG_RELEASE(TAG, fmt, ...) \
if (g_enable_log) { \
iflytop::zlock_guard lock(glog_mutex); \
printf(TAG "" fmt "\n", ##__VA_ARGS__); \
}
#define ZLOGI(TAG, fmt, ...) \
if (g_enable_log) { \
iflytop::zlock_guard lock(glog_mutex); \
printf("%08lu INFO [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZLOGD(TAG, fmt, ...) \
if (g_enable_log) { \
iflytop::zlock_guard lock(glog_mutex); \
printf("%08lu DEBU [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZLOGE(TAG, fmt, ...) \
if (g_enable_log) { \
iflytop::zlock_guard lock(glog_mutex); \
printf("%08lu ERRO [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZLOGW(TAG, fmt, ...) \
if (g_enable_log) { \
iflytop::zlock_guard lock(glog_mutex); \
printf("%08lu WARN [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZASSERT(cond) \
if (!(cond)) { \
while (1) { \
printf("ASSERT: %s [%s:%d]\n", #cond, __FILE__, __LINE__); \
zchip_clock_early_delayus(1000 * 1000); \
} \
}
void zos_loggger_init();
}