aboutsummaryrefslogtreecommitdiffstats
path: root/include/debugtools.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/debugtools.h')
-rw-r--r--include/debugtools.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/debugtools.h b/include/debugtools.h
new file mode 100644
index 0000000..cd6940b
--- /dev/null
+++ b/include/debugtools.h
@@ -0,0 +1,27 @@
+#ifndef DEBUGTOOLS_H
+#define DEBUGTOOLS_H
+
+#ifdef QT_NO_DEBUG
+
+void debug_msg(...) {}
+void debug_err(...) {}
+
+#else
+#include <iostream>
+
+#define debug_msg(msg) \
+do { \
+ std::cout << "DEBUG [" \
+ << __FILE__ << " @ " << __LINE__ \
+ << "]: " << msg << std::endl; \
+} while (0)
+
+#define debug_err(msg) \
+do { \
+ std::cerr << "ERROR [" \
+ << __FILE__ << " @ " << __LINE__ \
+ << "]: " << msg << std::endl; \
+} while (0)
+
+#endif // QT_NO_DEBUG
+#endif // DEBUGTOOLS_H