aboutsummaryrefslogtreecommitdiff
path: root/log/include
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2021-12-04 16:01:12 -0800
committer3gg <3gg@shellblade.net>2021-12-04 16:01:12 -0800
commitf8217d240d598f39f70047f7a623dd46312542c6 (patch)
tree4e40843d665e388416c1226f739c2b8c0b8da736 /log/include
parent5f6ea503cdb6ad4a95b679672a1ad324d96c89a5 (diff)
Initial commit.
Diffstat (limited to 'log/include')
-rw-r--r--log/include/log/log.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/log/include/log/log.h b/log/include/log/log.h
new file mode 100644
index 0000000..41a83cc
--- /dev/null
+++ b/log/include/log/log.h
@@ -0,0 +1,19 @@
1#pragma once
2
3// Current implementation assumes a posix environment.
4
5#include <stdio.h>
6
7typedef enum { LogDebug, LogInfo, LogWarning, LogError } LogLevel;
8
9#define LOG(tag, ...) \
10 { \
11 printf("[%s] %s:%d: ", #tag, __FILE__, __LINE__); \
12 printf(__VA_ARGS__); \
13 printf("\n"); \
14 }
15
16#define LOGD(...) LOG(DEBUG, __VA_ARGS__)
17#define LOGI(...) LOG(INFO, __VA_ARGS__)
18#define LOGW(...) LOG(WARN, __VA_ARGS__)
19#define LOGE(...) LOG(ERROR, __VA_ARGS__)