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.
 
 
 

58 lines
2.7 KiB

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