mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-25 18:46:55 +01:00
Dont format logging calls with only the format string
This commit is contained in:
parent
c209feeaaa
commit
f48ad6a1ca
@ -76,21 +76,28 @@ auto ForwardEnum(std::tuple<TArgs...> t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename ... TArgs>
|
template<typename T, typename ... TArgs>
|
||||||
bool cemuLog_log(LogType type, std::basic_string<T> format, TArgs&&... args)
|
bool cemuLog_log(LogType type, std::basic_string<T> formatStr, TArgs&&... args)
|
||||||
{
|
{
|
||||||
if (!cemuLog_isLoggingEnabled(type))
|
if (!cemuLog_isLoggingEnabled(type))
|
||||||
return false;
|
return false;
|
||||||
|
if constexpr (sizeof...(TArgs) == 0)
|
||||||
const auto format_view = fmt::basic_string_view<T>(format);
|
{
|
||||||
const auto text = fmt::vformat(format_view, fmt::make_format_args<fmt::buffer_context<T>>(ForwardEnum(args)...));
|
cemuLog_log(type, std::basic_string_view<T>(formatStr.data(), formatStr.size()));
|
||||||
cemuLog_log(type, std::basic_string_view(text.data(), text.size()));
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto format_view = fmt::basic_string_view<T>(formatStr);
|
||||||
|
const auto text = fmt::vformat(format_view, fmt::make_format_args<fmt::buffer_context<T>>(ForwardEnum(args)...));
|
||||||
|
cemuLog_log(type, std::basic_string_view(text.data(), text.size()));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename ... TArgs>
|
template<typename T, typename ... TArgs>
|
||||||
bool cemuLog_log(LogType type, const T* format, TArgs&&... args)
|
bool cemuLog_log(LogType type, const T* format, TArgs&&... args)
|
||||||
{
|
{
|
||||||
auto format_str=std::basic_string<T>(format);
|
auto format_str = std::basic_string<T>(format);
|
||||||
return cemuLog_log(type, format_str, std::forward<TArgs>(args)...);
|
return cemuLog_log(type, format_str, std::forward<TArgs>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user