aboutsummaryrefslogtreecommitdiff
path: root/log/include
diff options
context:
space:
mode:
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__)