From 15465e8b518d9413c11dcdcad712a6a51b3ebde2 Mon Sep 17 00:00:00 2001 From: Tharre Date: Thu, 27 Oct 2016 23:43:45 +0200 Subject: Implement logging using REDO_DEBUG env variable --- src/dbg.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/dbg.h') diff --git a/src/dbg.h b/src/dbg.h index 902d885..6e52ed4 100644 --- a/src/dbg.h +++ b/src/dbg.h @@ -25,12 +25,16 @@ #define DEBUG 0 #endif +extern int DBG_LVL; + /* helper functions which help in replacing the GNU extension ##__VA_ARGS__ */ #define STRINGIFY(x) #x #define PREFIX(...) PREFIX_HELPER(_FILENAME, __LINE__, __VA_ARGS__) #define SUFFIX(S, M, ...) M S, __VA_ARGS__ #define log_err(...) fprintf(stderr, PREFIX(__VA_ARGS__)) +#define log_warn(...) do { if (DBG_LVL > 2) log_err(__VA_ARGS__); } while (0) +#define log_info(...) do { if (DBG_LVL > 1) log_err(__VA_ARGS__); } while (0) #define die(...) die_(PREFIX(__VA_ARGS__)) #define fatal(...) die(SUFFIX(": %s\n", __VA_ARGS__, strerror(errno))) -- cgit v1.2.3-70-g09d2