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.
42 lines
1.9 KiB
42 lines
1.9 KiB
#pragma once
|
|
#include <stdio.h>
|
|
|
|
#include "basic_h/basic.hpp"
|
|
//
|
|
#include "clock.hpp"
|
|
|
|
extern "C" {
|
|
extern bool g_enable_log;
|
|
#define ZEARLY_LOG_RELEASE(TAG, fmt, ...) \
|
|
if (g_enable_log) { \
|
|
zchip_log(TAG "" fmt "\r\n", ##__VA_ARGS__); \
|
|
}
|
|
#define ZEARLY_LOGI(TAG, fmt, ...) \
|
|
if (g_enable_log) { \
|
|
zchip_log("%08lu INFO [%-8s] " fmt "\r\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
|
|
}
|
|
#define ZEARLY_LOGD(TAG, fmt, ...) \
|
|
if (g_enable_log) { \
|
|
zchip_log("%08lu DEBU [%-8s] " fmt "\r\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
|
|
}
|
|
#define ZEARLY_LOGE(TAG, fmt, ...) \
|
|
if (g_enable_log) { \
|
|
zchip_log("%08lu ERRO [%-8s] " fmt "\r\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
|
|
}
|
|
|
|
#define ZEARLY_LOGW(TAG, fmt, ...) \
|
|
if (g_enable_log) { \
|
|
zchip_log("%08lu WARN [%-8s] " fmt "\r\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
|
|
}
|
|
|
|
#define ZEARLY_ASSERT(cond) \
|
|
if (!(cond)) { \
|
|
while (1) { \
|
|
zchip_log("ASSERT: %s [%s:%d]\r\n", #cond, __FILE__, __LINE__); \
|
|
zchip_clock_early_delayus(1000 * 1000); \
|
|
} \
|
|
}
|
|
void zchip_log(const char* fmt, ...) ;
|
|
void zchip_loggger_init(zchip_uart_t* huart);
|
|
void zchip_loggger_enable(bool enable);
|
|
}
|