From f59ede03d8f1d9934823481bcea10c9cfd238c91 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Wed, 28 Aug 2024 09:41:36 -0700 Subject: Do not use __VA_OPT__ for now. --- log/include/log/log.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'log') diff --git a/log/include/log/log.h b/log/include/log/log.h index bd0c20c..c660881 100644 --- a/log/include/log/log.h +++ b/log/include/log/log.h @@ -10,14 +10,27 @@ #undef LOGW #undef LOGE -#define LOG(channel, tag, format, ...) \ +// __VA_OPT__ is not available until C2X. +/*#define LOG(channel, tag, format, ...) \ { \ fprintf( \ channel, "[%s] %s:%d " format "\n", #tag, __FILE__, \ __LINE__ __VA_OPT__(, ) __VA_ARGS__); \ - } + }*/ -#define LOGD(format, ...) LOG(stdout, DEBUG, format, __VA_ARGS__) +/*#define LOGD(format, ...) LOG(stdout, DEBUG, format, __VA_ARGS__) #define LOGI(format, ...) LOG(stdout, INFO, format, __VA_ARGS__) #define LOGW(format, ...) LOG(stdout, WARN, format, __VA_ARGS__) -#define LOGE(format, ...) LOG(stderr, ERROR, format, __VA_ARGS__) +#define LOGE(format, ...) LOG(stderr, ERROR, format, __VA_ARGS__)*/ + +#define LOG(channel, tag, ...) \ + { \ + fprintf(channel, "[%s] %s:%d ", #tag, __FILE__, __LINE__); \ + fprintf(channel, __VA_ARGS__); \ + fprintf(channel, "\n"); \ + } + +#define LOGD(...) LOG(stdout, DEBUG, __VA_ARGS__) +#define LOGI(...) LOG(stdout, INFO, __VA_ARGS__) +#define LOGW(...) LOG(stdout, WARN, __VA_ARGS__) +#define LOGE(...) LOG(stderr, ERROR, __VA_ARGS__) -- cgit v1.2.3