summary refs log tree commit diff
path: root/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'log.h')
-rw-r--r--log.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/log.h b/log.h
new file mode 100644
index 0000000..a1b0c16
--- /dev/null
+++ b/log.h
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-FileCopyrightText: 2020 Alyssa Ross <hi@alyssa.is>
+
+#include <stdarg.h>
+
+enum verbosity {
+	nothing,
+	errors,
+	all,
+};
+
+extern enum verbosity verbosity;
+
+// Log an error message, followed by strerrno(errno), then exit with
+// status eval.
+void diee(int eval, const char *fmt, ...) __attribute__((noreturn));
+
+// Log an error message.
+void elog(const char *fmt, ...);
+void velog(const char *fmt, va_list args);
+
+// Log an error message, followed by strerror(errno).
+void veloge(const char *fmt, va_list args);
+
+// Log an informative message.
+void ilog(const char *fmt, ...);
+void vilog(const char *fmt, va_list args);