aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/zencore/include/zencore/logging.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/zencore/include/zencore/logging.h b/src/zencore/include/zencore/logging.h
index e3eb524e9..d14d1ab8d 100644
--- a/src/zencore/include/zencore/logging.h
+++ b/src/zencore/include/zencore/logging.h
@@ -61,6 +61,13 @@ void EmitLogMessage(LoggerRef& Logger, const SourceLocation& Location, int LogLe
void EmitLogMessage(LoggerRef& Logger, int LogLevel, std::string_view Format, fmt::format_args Args);
void EmitLogMessage(LoggerRef& Logger, const SourceLocation& Location, int LogLevel, std::string_view Format, fmt::format_args Args);
+template<typename... T>
+auto
+LogCaptureArguments(T&&... Args)
+{
+ return fmt::make_format_args(Args...);
+}
+
} // namespace zen::logging
namespace zen {
@@ -121,7 +128,7 @@ LogIsErrorLevel(int LogLevel)
Location, \
InLevel, \
std::string_view(FormatString, sizeof FormatString - 1), \
- fmt::make_format_args(__VA_ARGS__)); \
+ zen::logging::LogCaptureArguments(__VA_ARGS__)); \
} \
} while (false);
@@ -137,7 +144,7 @@ LogIsErrorLevel(int LogLevel)
zen::logging::EmitLogMessage(Logger, \
InLevel, \
std::string_view(FormatString, sizeof FormatString - 1), \
- fmt::make_format_args(__VA_ARGS__)); \
+ zen::logging::LogCaptureArguments(__VA_ARGS__)); \
} \
} while (false);
@@ -159,12 +166,12 @@ LogIsErrorLevel(int LogLevel)
#define ZEN_ERROR(fmtstr, ...) ZEN_LOG_WITH_LOCATION(Log(), zen::logging::level::Err, fmtstr, ##__VA_ARGS__)
#define ZEN_CRITICAL(fmtstr, ...) ZEN_LOG_WITH_LOCATION(Log(), zen::logging::level::Critical, fmtstr, ##__VA_ARGS__)
-#define ZEN_CONSOLE_LOG(InLevel, fmtstr, ...) \
- do \
- { \
- using namespace std::literals; \
- ZEN_CHECK_FORMAT_STRING(fmtstr##sv, ##__VA_ARGS__); \
- zen::logging::EmitConsoleLogMessage(InLevel, fmtstr, fmt::make_format_args(__VA_ARGS__)); \
+#define ZEN_CONSOLE_LOG(InLevel, fmtstr, ...) \
+ do \
+ { \
+ using namespace std::literals; \
+ ZEN_CHECK_FORMAT_STRING(fmtstr##sv, ##__VA_ARGS__); \
+ zen::logging::EmitConsoleLogMessage(InLevel, fmtstr, zen::logging::LogCaptureArguments(__VA_ARGS__)); \
} while (false)
#define ZEN_CONSOLE(fmtstr, ...) ZEN_CONSOLE_LOG(zen::logging::level::Info, fmtstr, ##__VA_ARGS__)