summaryrefslogtreecommitdiff
path: root/src/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/log.h')
-rw-r--r--src/log.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/log.h b/src/log.h
new file mode 100644
index 0000000..6954106
--- /dev/null
+++ b/src/log.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <stdio.h>
+
+#define logb(FORMAT, ...) fprintf(stderr, "%s:%d: " FORMAT, __FILE__, __LINE__ __VA_OPT__(,) __VA_ARGS__)
+#define logc(FORMAT, ...) fprintf(stderr, FORMAT __VA_OPT__(,) __VA_ARGS__)
+#define lognl() fprintf(stderr, "\n")
+#define loge() lognl()
+
+#define log(FORMAT, ...) do { \
+ logb(FORMAT __VA_OPT__(,) __VA_ARGS__); \
+ loge(); \
+} while(0)