summaryrefslogtreecommitdiff
path: root/src/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug.h')
-rw-r--r--src/debug.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/debug.h b/src/debug.h
index 29a7114aa..8923e706b 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -12,6 +12,7 @@
#include "cpu.h"
#include <chrono>
+#include "3rdparty/fmt/format.h"
/* Debugging messages policy:
* These should be the severities used for direct DEBUG() calls
@@ -27,6 +28,16 @@
* 6.. - extremely detailed spamming
*/
+void debug_print(const char *dbg, const char *buf);
+
+/**
+ * Ouptut a line of debugging information.
+ * @param name The category of debug information.
+ * @param level The maximum debug level this message should be shown at. When the debug level for this category is set lower, then the message will not be shown.
+ * @param format_string The formatting string of the message.
+ */
+#define Debug(name, level, format_string, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) debug_print(#name, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__).c_str())
+
/**
* Output a line of debugging information.
* @param name Category