diff options
Diffstat (limited to 'log')
-rw-r--r-- | log/include/log/log.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/log/include/log/log.h b/log/include/log/log.h index bd0c20c..c660881 100644 --- a/log/include/log/log.h +++ b/log/include/log/log.h | |||
@@ -10,14 +10,27 @@ | |||
10 | #undef LOGW | 10 | #undef LOGW |
11 | #undef LOGE | 11 | #undef LOGE |
12 | 12 | ||
13 | #define LOG(channel, tag, format, ...) \ | 13 | // __VA_OPT__ is not available until C2X. |
14 | /*#define LOG(channel, tag, format, ...) \ | ||
14 | { \ | 15 | { \ |
15 | fprintf( \ | 16 | fprintf( \ |
16 | channel, "[%s] %s:%d " format "\n", #tag, __FILE__, \ | 17 | channel, "[%s] %s:%d " format "\n", #tag, __FILE__, \ |
17 | __LINE__ __VA_OPT__(, ) __VA_ARGS__); \ | 18 | __LINE__ __VA_OPT__(, ) __VA_ARGS__); \ |
18 | } | 19 | }*/ |
19 | 20 | ||
20 | #define LOGD(format, ...) LOG(stdout, DEBUG, format, __VA_ARGS__) | 21 | /*#define LOGD(format, ...) LOG(stdout, DEBUG, format, __VA_ARGS__) |
21 | #define LOGI(format, ...) LOG(stdout, INFO, format, __VA_ARGS__) | 22 | #define LOGI(format, ...) LOG(stdout, INFO, format, __VA_ARGS__) |
22 | #define LOGW(format, ...) LOG(stdout, WARN, format, __VA_ARGS__) | 23 | #define LOGW(format, ...) LOG(stdout, WARN, format, __VA_ARGS__) |
23 | #define LOGE(format, ...) LOG(stderr, ERROR, format, __VA_ARGS__) | 24 | #define LOGE(format, ...) LOG(stderr, ERROR, format, __VA_ARGS__)*/ |
25 | |||
26 | #define LOG(channel, tag, ...) \ | ||
27 | { \ | ||
28 | fprintf(channel, "[%s] %s:%d ", #tag, __FILE__, __LINE__); \ | ||
29 | fprintf(channel, __VA_ARGS__); \ | ||
30 | fprintf(channel, "\n"); \ | ||
31 | } | ||
32 | |||
33 | #define LOGD(...) LOG(stdout, DEBUG, __VA_ARGS__) | ||
34 | #define LOGI(...) LOG(stdout, INFO, __VA_ARGS__) | ||
35 | #define LOGW(...) LOG(stdout, WARN, __VA_ARGS__) | ||
36 | #define LOGE(...) LOG(stderr, ERROR, __VA_ARGS__) | ||