diff options
Diffstat (limited to 'src/dbg.h')
-rw-r--r-- | src/dbg.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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))) |