aboutsummaryrefslogtreecommitdiff
path: root/client/acronc/log.h
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2022-07-26 17:36:20 -0700
committerTrumeet <yuuta@yuuta.moe>2022-07-26 17:36:20 -0700
commit7099a86ca74fa637f26af38674f80fb8efd5f6fa (patch)
tree33315c65e82170476cf3c80d976dfa4d16a304a3 /client/acronc/log.h
parent8b07bf593e54dd876e30d0cb1c7c7226d0d1b1e2 (diff)
downloadacron-7099a86ca74fa637f26af38674f80fb8efd5f6fa.tar
acron-7099a86ca74fa637f26af38674f80fb8efd5f6fa.tar.gz
acron-7099a86ca74fa637f26af38674f80fb8efd5f6fa.tar.bz2
acron-7099a86ca74fa637f26af38674f80fb8efd5f6fa.zip
refactor(libacron/acronc/helloworld): move to separate directories
The corresponding CMakeLists.txt files are still rough.
Diffstat (limited to 'client/acronc/log.h')
-rw-r--r--client/acronc/log.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/client/acronc/log.h b/client/acronc/log.h
new file mode 100644
index 0000000..7bc9532
--- /dev/null
+++ b/client/acronc/log.h
@@ -0,0 +1,52 @@
+/*
+ * Created by yuuta on 1/1/22.
+ */
+
+#ifndef LOG_H
+#define LOG_H
+
+enum log_level {
+ log_fetal = 1,
+ log_error = 2,
+ log_warn = 3,
+ log_info = 4,
+ log_debug = 5
+};
+
+void g_log(enum log_level level,
+ const char *file,
+ int line,
+ const char *format,
+ ...);
+
+#define LOGF(X) g_log(log_fetal, __FUNCTION__, __LINE__, X)
+
+#define LOGFV(X, ...) g_log(log_fetal, __FUNCTION__, __LINE__, X, __VA_ARGS__)
+
+#define LOGE(X) g_log(log_error, __FUNCTION__, __LINE__, X)
+
+#define LOGEV(X, ...) g_log(log_error, __FUNCTION__, __LINE__, X, __VA_ARGS__)
+
+#define LOGW(X) g_log(log_warn, __FUNCTION__, __LINE__, X)
+
+#define LOGWV(X, ...) g_log(log_warn, __FUNCTION__, __LINE__, X, __VA_ARGS__)
+
+#define LOGI(X) g_log(log_info, __FUNCTION__, __LINE__, X)
+
+#define LOGIV(X, ...) g_log(log_info, __FUNCTION__, __LINE__, X, __VA_ARGS__)
+
+#ifdef DEBUG
+
+#define LOGD(X) g_log(log_debug, __FUNCTION__, __LINE__, X)
+
+#define LOGDV(X, ...) g_log(log_debug, __FUNCTION__, __LINE__, X, __VA_ARGS__)
+
+#else
+
+#define LOGD(X)
+
+#define LOGDV(X, ...)
+
+#endif
+
+#endif /* LOG_H */