|
7 | 7 | #pragma once |
8 | 8 |
|
9 | 9 | #ifdef _DEBUG |
| 10 | + |
| 11 | +inline void DebugLog(std::wstring_view str) |
| 12 | +{ |
| 13 | + DbgLogInfo(LOG_TRACE, 3, str.data()); |
| 14 | +} |
| 15 | + |
| 16 | +inline void DebugLog(std::string_view str) |
| 17 | +{ |
| 18 | + DbgLogInfo(LOG_TRACE, 3, str.data()); |
| 19 | +} |
| 20 | + |
10 | 21 | template <typename... Args> |
11 | | -inline void DebugLogFmt(std::wstring_view format, Args&& ...args) |
| 22 | +inline void DebugLog(std::wformat_string<Args...> fmt, Args&&... args) |
12 | 23 | { |
13 | | - if (sizeof...(Args)) { |
14 | | - DbgLogInfo(LOG_TRACE, 3, std::vformat(format, std::make_wformat_args(args...)).c_str()); |
15 | | - } else { |
16 | | - DbgLogInfo(LOG_TRACE, 3, format.data()); |
17 | | - } |
| 24 | + DbgLogInfo(LOG_TRACE, 3, std::format(fmt, std::forward<Args>(args)...).c_str()); |
18 | 25 | } |
19 | 26 |
|
20 | 27 | template <typename... Args> |
21 | | -inline void DebugLogFmt(std::string_view format, Args&& ...args) |
| 28 | +inline void DebugLog(std::format_string<Args...> fmt, Args&&... args) |
22 | 29 | { |
23 | | - if (sizeof...(Args)) { |
24 | | - DbgLogInfo(LOG_TRACE, 3, std::vformat(format, std::make_format_args(args...)).c_str()); |
25 | | - } else { |
26 | | - DbgLogInfo(LOG_TRACE, 3, format.data()); |
27 | | - } |
| 30 | + DbgLogInfo(LOG_TRACE, 3, std::format(fmt, std::forward<Args>(args)...).c_str()); |
28 | 31 | } |
29 | 32 |
|
30 | | -#define DLog(...) DebugLogFmt(__VA_ARGS__) |
31 | | -#define DLogIf(f,...) {if (f) DebugLogFmt(__VA_ARGS__);} |
| 33 | +#define DLog(...) DebugLog(__VA_ARGS__) |
| 34 | +#define DLogIf(f,...) {if (f) DebugLog(__VA_ARGS__);} |
32 | 35 | #else |
33 | 36 | #define DLog(...) __noop |
34 | 37 | #define DLogIf(f,...) __noop |
|
0 commit comments