diff --git a/library/common/common.c b/library/common/common.c index 22e9543..68e0e9a 100644 --- a/library/common/common.c +++ b/library/common/common.c @@ -2,10 +2,20 @@ #include #include #include "common.h" +#include // 必须包含此头文件以使用变参宏 WEAK void elog_output(uint8_t level, const char *tag, const char *file, const char *func, long line, const char *format, ...) { - RD_PRINTF("[%u/%s] [%s] (%s:%ld) %s\r\n", level, tag, func, file, line, format); +#ifdef BUILD_COMMON + va_list args; + RD_PRINTF("[%u/%s] [%s] (%s:%ld) ", level, tag, func, file, line); + va_start(args, format); + vprintf(format, args); + va_end(args); + RD_PRINTF("\r\n"); +#else + RD_PRINTF("[%u/%s] [%s] (%s:%ld) %s\r\n", level, tag, func, file, line, format); +#endif } /**