1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#ifdef _RELEASE
#define ANY_LOG_FORMAT_BEFORE(stream, level, context, module, func) \
fprintf(stream, "[%s%s%s%s%s%s%s] %s%s%s: ", \
ANY_LOG_COLOR_GET(ANY_LOG_COLOR_CONTEXT), context, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), *context ? " " : "", \
ANY_LOG_COLOR_GET(ANY_LOG_COLOR_MODULE), *func ? func : module, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), \
ANY_LOG_COLOR_GET(level), any_log_level_strings[level], ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET))
#define ANY_LOG_VALUE_BEFORE(stream, level, context, module, func, message) \
fprintf(stream, "[%s%s%s%s%s%s%s] %s%s%s: %s [", \
ANY_LOG_COLOR_GET(ANY_LOG_COLOR_CONTEXT), context, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), *context ? " " : "", \
ANY_LOG_COLOR_GET(ANY_LOG_COLOR_MODULE), *func ? func : module, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), \
ANY_LOG_COLOR_GET(level), any_log_level_strings[level], ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), message)
#else
#define ANY_LOG_FORMAT_BEFORE(stream, level, context, module, func) \
fprintf(stream, "[%s%s%s%s%s%s%s%s%s%s%s] %s%s%s: ", \
ANY_LOG_COLOR_GET(ANY_LOG_COLOR_CONTEXT), context, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), *context ? " " : "", \
ANY_LOG_COLOR_GET(ANY_LOG_COLOR_MODULE), module, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), *func ? " " : "", \
ANY_LOG_COLOR_GET(ANY_LOG_COLOR_FUNC), func, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), \
ANY_LOG_COLOR_GET(level), any_log_level_strings[level], ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET))
#define ANY_LOG_VALUE_BEFORE(stream, level, context, module, func, message) \
fprintf(stream, "[%s%s%s%s%s%s%s%s%s%s%s] %s%s%s: %s [", \
ANY_LOG_COLOR_GET(ANY_LOG_COLOR_CONTEXT), context, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), *context ? " " : "", \
ANY_LOG_COLOR_GET(ANY_LOG_COLOR_MODULE), module, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), *func ? " " : "", \
ANY_LOG_COLOR_GET(ANY_LOG_COLOR_FUNC), func, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), \
ANY_LOG_COLOR_GET(level), any_log_level_strings[level], ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), message)
#endif
#define ANY_LOG_VALUE_STRING(stream, key, value) \
fprintf(stream, "%s=\"%s\"", key, value ? value : "(null)")
#define ANY_LOG_COLOR_CONTEXT_DEFAULT "\x1b[34m"
#define ANY_LOG_IMPLEMENT
#include "log.h"
|