logging.h: Add helpers so the log macros can have just one argument, needed for compilation on visual studio

pull/421/head
Jerry Jacobs 2016-05-20 18:12:41 +02:00
rodzic 8da1467bb1
commit 893fa4f8da
1 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -20,11 +20,18 @@ enum ugly_loglevel {
int ugly_init(int maximum_threshold); int ugly_init(int maximum_threshold);
int ugly_log(int level, const char *tag, const char *format, ...); int ugly_log(int level, const char *tag, const char *format, ...);
#define DLOG(format, args...) ugly_log(UDEBUG, __FILE__, format, ## args) /** @todo we need to write this in a more generic way, for now this should compile
#define ILOG(format, args...) ugly_log(UINFO, __FILE__, format, ## args) on visual studio (See http://stackoverflow.com/a/8673872/1836746) */
#define WLOG(format, args...) ugly_log(UWARN, __FILE__, format, ## args) #define DLOG_HELPER(format, ...) ugly_log(UDEBUG, __FILE__, format, __VA_ARGS__)
#define ELOG(format, args...) ugly_log(UERROR, __FILE__, format, ## args) #define DLOG(...) DLOG_HELPER(__VA_ARGS__, "")
#define fatal(format, args...) ugly_log(UFATAL, __FILE__, format, ## args) #define ILOG_HELPER(format, ...) ugly_log(UINFO, __FILE__, format, __VA_ARGS__)
#define ILOG(...) ILOG_HELPER(__VA_ARGS__, "")
#define WLOG_HELPER(format, ...) ugly_log(UWARN, __FILE__, format, __VA_ARGS__)
#define WLOG(...) WLOG_HELPER(__VA_ARGS__, "")
#define ELOG_HELPER(format, ...) ugly_log(UERROR, __FILE__, format, __VA_ARGS__)
#define ELOG(...) ELOG_HELPER(__VA_ARGS__, "")
#define fatal_helper(format, ...) ugly_log(UFATAL, __FILE__, format, __VA_ARGS__)
#define fatal(...) fatal_helper(__VA_ARGS__, "")
#ifdef __cplusplus #ifdef __cplusplus
} }