Fixed build

pull/3028/head
gabime 2 years ago
parent 536da46a2c
commit 3979bd15f7

@ -339,18 +339,26 @@ constexpr spdlog::wstring_view_t to_string_view(spdlog::wstring_view_t str) noex
}
#endif
// convert format_string<...> to string_view depending on std::format or {fmt} versions
#ifndef SPDLOG_USE_STD_FORMAT
template<typename T, typename... Args>
inline fmt::basic_string_view<T> to_string_view(fmt::basic_format_string<T, Args...> fmt)
constexpr inline fmt::basic_string_view<T> to_string_view(fmt::basic_format_string<T, Args...> fmt) noexcept
{
return fmt;
}
#elif __cpp_lib_format >= 202207L
#elif __cpp_lib_format >= 202207L // std::format and __cpp_lib_format >= 202207L
template<typename T, typename... Args>
constexpr std::basic_string_view<T> to_string_view(std::basic_format_string<T, Args...> fmt) noexcept
{
return fmt.get();
}
#else // std::format and __cpp_lib_format < 202207L
template<typename T, typename... Args>
constexpr std::basic_string_view<T> to_string_view(std::basic_format_string<T, Args...> fmt) noexcept
{
return fmt;
}
#endif
} // namespace details

@ -81,7 +81,7 @@ public:
{
if (should_log(lvl))
{
log_with_format_(loc, lvl, fmt.get(), std::forward<Args>(args)...);
log_with_format_(loc, lvl, details::to_string_view(fmt), std::forward<Args>(args)...);
}
}
@ -90,7 +90,7 @@ public:
{
if (should_log(lvl))
{
log_with_format_(source_loc{}, lvl, fmt.get(), std::forward<Args>(args)...);
log_with_format_(source_loc{}, lvl, details::to_string_view(fmt), std::forward<Args>(args)...);
}
}

Loading…
Cancel
Save