From c3966c776014e5b8eacbe983f9a9ba259b48543c Mon Sep 17 00:00:00 2001 From: xinyang <895639507@qq.com> Date: Mon, 1 Jul 2019 11:16:45 +0800 Subject: [PATCH] =?UTF-8?q?log.h=E7=8E=B0=E5=9C=A8=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E8=AE=BE=E7=BD=AELOG=5FOUT=E5=AE=8F=E5=86=B3?= =?UTF-8?q?=E5=AE=9A=E8=BE=93=E5=87=BA=E4=BD=8D=E7=BD=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- others/include/log.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/others/include/log.h b/others/include/log.h index fe530b3..51b4724 100644 --- a/others/include/log.h +++ b/others/include/log.h @@ -80,20 +80,25 @@ #ifndef LOG_LINK_COLOR #define LOG_LINK_COLOR LINE_CODE WORD_BLUE #endif + +/********************** log place *************************/ +#ifndef LOG_OUT + #define LOG_OUT stdout +#endif /******************** The log API *************************/ -#define LOG_0(format, ...) printf(format, ##__VA_ARGS__) +#define LOG_0(format, ...) fprintf(LOG_OUT, format, ##__VA_ARGS__) #if LOG_LEVEL >= LOG_ERROR - #define LOG_1(format, ...) printf(format, ##__VA_ARGS__) + #define LOG_1(format, ...) fprintf(LOG_OUT, format, ##__VA_ARGS__) #else #define LOG_1(format, ...) ((void)0) #endif #if LOG_LEVEL >= LOG_WARNING - #define LOG_2(format, ...) printf(format, ##__VA_ARGS__) + #define LOG_2(format, ...) fprintf(LOG_OUT, format, ##__VA_ARGS__) #else #define LOG_2(format, ...) ((void)0) #endif #if LOG_LEVEL >= LOG_MSG - #define LOG_3(format, ...) printf(format, ##__VA_ARGS__) + #define LOG_3(format, ...) fprintf(LOG_OUT, format, ##__VA_ARGS__) #else #define LOG_3(format, ...) ((void)0) #endif