aboutsummaryrefslogtreecommitdiff
path: root/src/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/log.h')
-rw-r--r--src/log.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/log.h b/src/log.h
new file mode 100644
index 0000000..2e8167b
--- /dev/null
+++ b/src/log.h
@@ -0,0 +1,36 @@
+#ifndef SKHD_LOG_H
+#define SKHD_LOG_H
+
+static bool verbose;
+
+static inline void
+debug(const char *format, ...)
+{
+ if (!verbose) return;
+
+ va_list args;
+ va_start(args, format);
+ vfprintf(stdout, format, args);
+ va_end(args);
+}
+
+static inline void
+warn(const char *format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+}
+
+static inline void
+error(const char *format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ exit(EXIT_FAILURE);
+}
+
+#endif