diff options
author | 3gg <3gg@shellblade.net> | 2021-12-04 16:01:12 -0800 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2021-12-04 16:01:12 -0800 |
commit | f8217d240d598f39f70047f7a623dd46312542c6 (patch) | |
tree | 4e40843d665e388416c1226f739c2b8c0b8da736 /log/include | |
parent | 5f6ea503cdb6ad4a95b679672a1ad324d96c89a5 (diff) |
Initial commit.
Diffstat (limited to 'log/include')
-rw-r--r-- | log/include/log/log.h | 19 |
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 | |||
7 | typedef 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__) | ||