diff --git a/CommonLibSF/include/RE/C/ConsoleLog.h b/CommonLibSF/include/RE/C/ConsoleLog.h index 322a1efe..703bb45b 100644 --- a/CommonLibSF/include/RE/C/ConsoleLog.h +++ b/CommonLibSF/include/RE/C/ConsoleLog.h @@ -14,6 +14,14 @@ namespace RE return *singleton; } + void VPrint(const char* a_fmt, std::va_list a_args) + { + using func_t = decltype(&ConsoleLog::VPrint); + REL::Relocation func{ REL::ID(166358) }; + func(this, a_fmt, a_args); + } + + // printf format rules, no compile time checking void Print(const char* a_fmt, ...) { std::va_list args; @@ -22,11 +30,11 @@ namespace RE va_end(args); } - void VPrint(const char* a_fmt, std::va_list a_args) + // std::format rules, compile time checking + template + void Log(const std::format_string a_fmt, Args&&... a_args) { - using func_t = decltype(&ConsoleLog::VPrint); - REL::Relocation func{ REL::ID(166358) }; - func(this, a_fmt, a_args); + Print(std::vformat(a_fmt.get(), std::make_format_args(a_args...)).c_str()); } }; }