diff --git a/config/zlog.conf b/config/zlog.conf index 31c4868..6376df4 100644 --- a/config/zlog.conf +++ b/config/zlog.conf @@ -7,7 +7,7 @@ buffer max = 2MB #rotate lock file = /tmp/zlog.lock rotate lock file = self -default format = "%d(%F %T.%l) %-6V (%c:%f:%L) - %m%n" +default format = "%d(%F %T.%l) %-6V (%c:%f:%L) %m%n" file perms = 600 fsync period = 1K @@ -18,7 +18,7 @@ CRIT = 130, LOG_CRIT [formats] simple = "%m" -normal = "[%d(%F %T).%ms][%-6V][%c][%f:%L] - %m" +normal = "[%d(%F %T).%ms][%-6V][%c][%f:%L] %m" [rules] *.* >stdout; normal diff --git a/srcs/libs/include/zlog_module.h b/srcs/libs/include/zlog_module.h index 75d756c..05f01dc 100644 --- a/srcs/libs/include/zlog_module.h +++ b/srcs/libs/include/zlog_module.h @@ -53,31 +53,17 @@ typedef enum { // ZLOG_MOD_MAX, //} ZLOG_MOD_NAME; -#define LOG_MSG(level, format, ...) \ - do { \ - zlog_##level(zlog_get_mod_cat(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, format, ...) LOG_MOD_HEX(level, ZLOG_MOD_MAIN, format, ##__VA_ARGS__) + +#define LOG_MOD(level, mod, format, ...) \ + do { \ + zlog_##level(zlog_get_mod_cat((mod)), format, ##__VA_ARGS__); \ } while (0) -#define LOG_MOD(level, mod, format, ...) \ - do { \ - zlog_category_t *cat; \ - if ((cat = zlog_get_mod_cat((mod))) == NULL) { \ - printf("Unsupport log mod %d\n", mod); \ - break; \ - } else { \ - zlog_##level((cat), format, ##__VA_ARGS__); \ - } \ - } while (0) - -#define LOG_MOD_HEX(level, mod, format, ...) \ - do { \ - zlog_category_t *cat; \ - if ((cat = zlog_get_mod_cat((mod))) == NULL) { \ - printf("Unsupport log mod %d\n", mod); \ - break; \ - } else { \ - hzlog_##level((cat), format, ##__VA_ARGS__); \ - } \ +#define LOG_MOD_HEX(level, mod, format, ...) \ + do { \ + hzlog_##level(zlog_get_mod_cat((mod)), format, ##__VA_ARGS__); \ } while (0) zlog_category_t *zlog_get_mod_cat(ZLOG_MOD_NAME logMod);