1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#pragma once
#include <stdio.h>
// Undef any previously defined log macros (from cassert.h, for example) to
// redefine them without compiler warnings.
#undef LOG
#undef LOGD
#undef LOGI
#undef LOGW
#undef LOGE
#define LOG(channel, tag, format, ...) \
{ \
fprintf( \
channel, "[%s] %s:%d " format "\n", #tag, __FILE__, \
__LINE__ __VA_OPT__(, ) __VA_ARGS__); \
}
#define LOGD(format, ...) LOG(stdout, DEBUG, format, __VA_ARGS__)
#define LOGI(format, ...) LOG(stdout, INFO, format, __VA_ARGS__)
#define LOGW(format, ...) LOG(stdout, WARN, format, __VA_ARGS__)
#define LOGE(format, ...) LOG(stderr, ERROR, format, __VA_ARGS__)
|