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