From 84ab5cf3dee88e6c64d3fb1b4182a3b4153893cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=98=95?= Date: Mon, 15 May 2023 17:39:00 +0800 Subject: [PATCH] =?UTF-8?q?OCT=201.=20=E6=9B=B4=E6=AD=A316=E8=BF=9B?= =?UTF-8?q?=E5=88=B6=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0=E5=AE=8F=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- srcs/libs/include/zlog_module.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/srcs/libs/include/zlog_module.h b/srcs/libs/include/zlog_module.h index 2e46d57..7c8d8ee 100644 --- a/srcs/libs/include/zlog_module.h +++ b/srcs/libs/include/zlog_module.h @@ -24,7 +24,7 @@ typedef enum { fatal = ZLOG_LEVEL_FATAL } ZLOG_LV; -#define DEF_ZLOG_MOD(ZLOG_MOD) \ +#define DEF_ZLOG_MOD(ZLOG_MOD) \ ZLOG_MOD(ZLOG_MOD_MAIN, ZLOG_LEVEL_INFO, "MAIN") \ ZLOG_MOD(ZLOG_MOD_TASK, ZLOG_LEVEL_INFO, "TASK") \ ZLOG_MOD(ZLOG_MOD_INIT, ZLOG_LEVEL_INFO, "INIT") \ @@ -36,8 +36,8 @@ typedef enum { ZLOG_MOD(ZLOG_MOD_CRYPTO, ZLOG_LEVEL_INFO, "CRYPTO") \ ZLOG_MOD(ZLOG_MOD_MQ, ZLOG_LEVEL_INFO, "MQ") \ ZLOG_MOD(ZLOG_MOD_PROTO, ZLOG_LEVEL_INFO, "PROTO") \ - ZLOG_MOD(ZLOG_MOD_HTTPD, ZLOG_LEVEL_INFO, "HTTPD") \ - ZLOG_MOD(ZLOG_MOD_JSCHEM, ZLOG_LEVEL_INFO, "JSCHEM") \ + ZLOG_MOD(ZLOG_MOD_HTTPD, ZLOG_LEVEL_INFO, "HTTPD") \ + ZLOG_MOD(ZLOG_MOD_JSCHEM, ZLOG_LEVEL_INFO, "JSCHEM") \ ZLOG_MOD(ZLOG_MOD_USER, ZLOG_LEVEL_INFO, "USER") \ ZLOG_MOD(ZLOG_MOD_PPPOE, ZLOG_LEVEL_INFO, "PPPOE") \ ZLOG_MOD(ZLOG_MOD_VXLAN, ZLOG_LEVEL_INFO, "VXLAN") \ @@ -63,8 +63,8 @@ typedef enum { zlog(cat, __FILE__, sizeof(__FILE__) - 1, __func__, sizeof(__func__) - 1, __LINE__, ZLOG_LEVEL_TRACE, format, \ ##__VA_ARGS__) -#define LOG_MSG(level, format, ...) LOG_MOD(level, ZLOG_MOD_MAIN, format, ##__VA_ARGS__) -#define LOG_MSG_HEX(level, format, ...) LOG_MOD_HEX(level, ZLOG_MOD_MAIN, format, ##__VA_ARGS__) +#define LOG_MSG(level, format, ...) LOG_MOD(level, ZLOG_MOD_MAIN, format, ##__VA_ARGS__) +#define LOG_MSG_HEX(level, buf, len) LOG_MOD_HEX(level, ZLOG_MOD_MAIN, (buf), (len)) #define LOG_MOD(level, mod, format, ...) \ do { \ @@ -76,15 +76,15 @@ typedef enum { } \ } while (0) -#define LOG_MOD_HEX(level, mod, format, ...) \ - do { \ - if (zlog_verify_level(level, mod)) { \ - if (zlog_vni_tag_get()) { \ - zlog_put_mdc("vni", zlog_vni_tag_get()); \ - } \ - hzlog_##level(zlog_get_mod_cat((mod)), format, ##__VA_ARGS__); \ - printf("\n"); \ - } \ +#define LOG_MOD_HEX(level, mod, buf, len) \ + do { \ + if (zlog_verify_level(level, mod)) { \ + if (zlog_vni_tag_get()) { \ + zlog_put_mdc("vni", zlog_vni_tag_get()); \ + } \ + hzlog_##level(zlog_get_mod_cat((mod)), (buf), (len)); \ + printf("\n"); \ + } \ } while (0) zlog_category_t *zlog_get_mod_cat(ZLOG_MOD_NAME logMod);