Repository navigation
Expand file tree
/
Copy pathcommon.h
More file actions
56 lines (46 loc) · 1.57 KB
/
Copy pathcommon.h
File metadata and controls
56 lines (46 loc) · 1.57 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include "logger.hpp"
#include <iostream>
inline bool g_ServiceFlag = false;
inline bool g_LoggingFlag = false;
#define INTERCEPT_LOG_DEBUG(logger, fmt, ...) do { \
if (g_LoggingFlag) { \
LOG_DEBUG(g_Logger, fmt, __VA_ARGS__); \
} \
} while (0)
#define INTERCEPT_LOG_ERROR(logger, fmt, ...) do { \
if (g_LoggingFlag) { \
LOG_ERROR(g_Logger, fmt, __VA_ARGS__); \
} \
} while (0)
#define INTERCEPT_PRINTLN(_fmt, ...) do { \
if (!g_ServiceFlag) { \
fmt::println(_fmt, __VA_ARGS__); \
} \
} while (0)
#define INTERCEPT_EPRINTLN(_fmt, ...) do { \
if (!g_ServiceFlag) { \
fmt::println(std::cerr, _fmt, __VA_ARGS__); \
} \
} while (0)
#define INTERCEPT_EPRINTLNW(_fmt, ...) do { \
if (!g_ServiceFlag) { \
fmt::println(std::wcerr, _fmt, __VA_ARGS__); \
} \
} while (0)
#define INTERCEPT_LOGD_N_OUT(logger, fmt, ...) do { \
INTERCEPT_LOG_DEBUG(logger, fmt, __VA_ARGS__); \
INTERCEPT_PRINTLN(fmt, __VA_ARGS__); \
} while (0)
#define INTERCEPT_LOGD_N_OUTW(logger, fmt, ...) do { \
INTERCEPT_LOG_DEBUG(logger, fmt, __VA_ARGS__); \
INTERCEPT_PRINTLN(L##fmt, __VA_ARGS__); \
} while (0)
#define INTERCEPT_LOGE_N_ERR(logger, fmt, ...) do { \
INTERCEPT_LOG_ERROR(logger, fmt, __VA_ARGS__); \
INTERCEPT_EPRINTLN(fmt, __VA_ARGS__); \
} while (0)
#define INTERCEPT_LOGE_N_ERRW(logger, fmt, ...) do { \
INTERCEPT_LOG_ERROR(logger, fmt, __VA_ARGS__); \
INTERCEPT_EPRINTLNW(L##fmt, __VA_ARGS__); \
} while (0)