diff options
| -rw-r--r-- | log/include/log/log.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/log/include/log/log.h b/log/include/log/log.h index 2dc5f9b..8f12b09 100644 --- a/log/include/log/log.h +++ b/log/include/log/log.h | |||
| @@ -2,14 +2,14 @@ | |||
| 2 | 2 | ||
| 3 | #include <stdio.h> | 3 | #include <stdio.h> |
| 4 | 4 | ||
| 5 | #define LOG(channel, tag, ...) \ | 5 | #define LOG(channel, tag, format, ...) \ |
| 6 | { \ | 6 | { \ |
| 7 | fprintf(channel, "[%s] %s:%d: ", #tag, __FILE__, __LINE__); \ | 7 | fprintf( \ |
| 8 | fprintf(channel, __VA_ARGS__); \ | 8 | channel, "[%s] %s:%d " format "\n", #tag, __FILE__, \ |
| 9 | fprintf(channel, "\n"); \ | 9 | __LINE__ __VA_OPT__(, ) __VA_ARGS__); \ |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | #define LOGD(...) LOG(stdout, DEBUG, __VA_ARGS__) | 12 | #define LOGD(format, ...) LOG(stdout, DEBUG, format, __VA_ARGS__) |
| 13 | #define LOGI(...) LOG(stdout, INFO, __VA_ARGS__) | 13 | #define LOGI(format, ...) LOG(stdout, INFO, format, __VA_ARGS__) |
| 14 | #define LOGW(...) LOG(stdout, WARN, __VA_ARGS__) | 14 | #define LOGW(format, ...) LOG(stdout, WARN, format, __VA_ARGS__) |
| 15 | #define LOGE(...) LOG(stderr, ERROR, __VA_ARGS__) | 15 | #define LOGE(format, ...) LOG(stderr, ERROR, format, __VA_ARGS__) |
