aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbg.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbg.h')
-rw-r--r--src/dbg.h4
1 files changed, 4 insertions, 0 deletions
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)))