diff --git a/os/zoslogger.cpp b/os/zoslogger.cpp index 4fd6006..551051e 100644 --- a/os/zoslogger.cpp +++ b/os/zoslogger.cpp @@ -18,4 +18,9 @@ void zos_log(const char* fmt, ...) { va_end(args); } } +void zlog_raw(const char* info) { + if (g_enable_log) { + printf(info); + } +} } diff --git a/os/zoslogger.hpp b/os/zoslogger.hpp index 55027e0..64e3897 100644 --- a/os/zoslogger.hpp +++ b/os/zoslogger.hpp @@ -13,26 +13,26 @@ extern bool g_enable_log; if (g_enable_log) { \ zos_log(TAG "" fmt "\n", ##__VA_ARGS__); \ } -#define ZLOGI(TAG, fmt, ...) \ - if (g_enable_log) { \ +#define ZLOGI(TAG, fmt, ...) \ + if (g_enable_log) { \ zos_log("%08lu INFO [%-10s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \ } -#define ZLOGI_NOT_END_LINE(TAG, fmt, ...) \ - if (g_enable_log) { \ +#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) { \ +#define ZLOGD(TAG, fmt, ...) \ + if (g_enable_log) { \ zos_log("%08lu DEBU [%-10s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \ } -#define ZLOGE(TAG, fmt, ...) \ - if (g_enable_log) { \ +#define ZLOGE(TAG, fmt, ...) \ + if (g_enable_log) { \ zos_log("%08lu ERRO [%-10s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \ } -#define ZLOGW(TAG, fmt, ...) \ - if (g_enable_log) { \ +#define ZLOGW(TAG, fmt, ...) \ + if (g_enable_log) { \ zos_log("%08lu WARN [%-10s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \ } @@ -43,6 +43,16 @@ extern bool g_enable_log; 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(); }