summaryrefslogtreecommitdiffstats
path: root/diag.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-06-02 15:39:19 -0400
committerTavian Barnes <tavianator@tavianator.com>2020-06-02 15:40:30 -0400
commita1c8bda52a9c07d32127762ee0c865660a0268ab (patch)
treec79a8a60573fa712c898ece6021929ab539e625e /diag.h
parentc074645660f58faee1f653e4e8bd1ebf832c21f1 (diff)
downloadbfs-a1c8bda52a9c07d32127762ee0c865660a0268ab.tar.xz
diag: Unify debug printing
Diffstat (limited to 'diag.h')
-rw-r--r--diag.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/diag.h b/diag.h
index 54f2366..2e5513e 100644
--- a/diag.h
+++ b/diag.h
@@ -24,6 +24,7 @@
#include "cmdline.h"
#include "util.h"
#include <stdarg.h>
+#include <stdbool.h>
/**
* Shorthand for printing error messages.
@@ -33,9 +34,19 @@ void bfs_error(const struct cmdline *cmdline, const char *format, ...);
/**
* Shorthand for printing warning messages.
+ *
+ * @return Whether a warning was printed.
*/
BFS_FORMATTER(2, 3)
-void bfs_warning(const struct cmdline *cmdline, const char *format, ...);
+bool bfs_warning(const struct cmdline *cmdline, const char *format, ...);
+
+/**
+ * Shorthand for printing debug messages.
+ *
+ * @return Whether a debug message was printed.
+ */
+BFS_FORMATTER(3, 4)
+bool bfs_debug(const struct cmdline *cmdline, enum debug_flags flag, const char *format, ...);
/**
* bfs_error() variant that takes a va_list.
@@ -45,7 +56,12 @@ void bfs_verror(const struct cmdline *cmdline, const char *format, va_list args)
/**
* bfs_warning() variant that takes a va_list.
*/
-void bfs_vwarning(const struct cmdline *cmdline, const char *format, va_list args);
+bool bfs_vwarning(const struct cmdline *cmdline, const char *format, va_list args);
+
+/**
+ * bfs_debug() variant that takes a va_list.
+ */
+bool bfs_vdebug(const struct cmdline *cmdline, enum debug_flags flag, const char *format, va_list args);
/**
* Print the error message prefix.
@@ -55,6 +71,11 @@ void bfs_error_prefix(const struct cmdline *cmdline);
/**
* Print the warning message prefix.
*/
-void bfs_warning_prefix(const struct cmdline *cmdline);
+bool bfs_warning_prefix(const struct cmdline *cmdline);
+
+/**
+ * Print the debug message prefix.
+ */
+bool bfs_debug_prefix(const struct cmdline *cmdline, enum debug_flags flag);
#endif // BFS_DIAG_H