From 6003db85621f516f4485db3400048f901e38f1c0 Mon Sep 17 00:00:00 2001 From: Jordon Brooks Date: Sat, 21 Jun 2025 20:38:04 +0100 Subject: [PATCH] Update Log.h --- FluxEngine/src/public/Log.h | 41 ++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/FluxEngine/src/public/Log.h b/FluxEngine/src/public/Log.h index 538f66f..7ad3419 100644 --- a/FluxEngine/src/public/Log.h +++ b/FluxEngine/src/public/Log.h @@ -2,6 +2,7 @@ #include #include +#include #include "Core.h" @@ -24,14 +25,44 @@ public: void LogError(const std::string& message); void LogFatal(const std::string& message); + template + void LogTrace(std::format_string fmt, Args&&... args) + { + LogTrace(std::format(fmt, std::forward(args)...)); + } + + template + void LogInfo(std::format_string fmt, Args&&... args) + { + LogInfo(std::format(fmt, std::forward(args)...)); + } + + template + void LogWarn(std::format_string fmt, Args&&... args) + { + LogWarn(std::format(fmt, std::forward(args)...)); + } + + template + void LogError(std::format_string fmt, Args&&... args) + { + LogError(std::format(fmt, std::forward(args)...)); + } + + template + void LogFatal(std::format_string fmt, Args&&... args) + { + LogFatal(std::format(fmt, std::forward(args)...)); + } + private: spdlog::logger* GetLogger() const; LoggerImpl& _impl; }; -#define LOG_TRACE(message) ::FluxEngine::GetLogger()->LogTrace(message) -#define LOG_INFO(message) ::FluxEngine::GetLogger()->LogInfo(message) -#define LOG_WARN(message) ::FluxEngine::GetLogger()->LogWarn(message) -#define LOG_ERROR(message) ::FluxEngine::GetLogger()->LogError(message) -#define LOG_FATAL(message) ::FluxEngine::GetLogger()->LogFatal(message) +#define LOG_TRACE(...) ::FluxEngine::GetLogger()->LogTrace(__VA_ARGS__) +#define LOG_INFO(...) ::FluxEngine::GetLogger()->LogInfo (__VA_ARGS__) +#define LOG_WARN(...) ::FluxEngine::GetLogger()->LogWarn (__VA_ARGS__) +#define LOG_ERROR(...) ::FluxEngine::GetLogger()->LogError(__VA_ARGS__) +#define LOG_FATAL(...) ::FluxEngine::GetLogger()->LogFatal(__VA_ARGS__)