summaryrefslogtreecommitdiff
path: root/src/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/log.c b/src/log.c
new file mode 100644
index 0000000..eb4d165
--- /dev/null
+++ b/src/log.c
@@ -0,0 +1,40 @@
+#include <stdio.h>
+
+void log_error(const char *const fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stderr, "[ERROR]: ");
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+
+void log_warning(const char *const fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stderr, "[WARNING]: ");
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+
+void log_debug(const char *const fmt, ...)
+{
+#ifndef DEBUG
+ return;
+#endif
+ va_list args;
+ va_start(args, fmt);
+ printf("[DEBUG]: ");
+ vprintf(fmt, args);
+ va_end(args);
+}
+
+void log_info(const char *const fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ printf("[INFO]: ");
+ vprintf(fmt, args);
+ va_end(args);
+}