|
|
|
@ -357,7 +357,7 @@ protected:
|
|
|
|
|
|
|
|
|
|
// common implementation for after templated public api has been resolved
|
|
|
|
|
template<typename... Args>
|
|
|
|
|
void log_(source_loc loc, level::level_enum lvl, string_view_t fmt, Args &&... args)
|
|
|
|
|
void log_(source_loc loc, level::level_enum lvl, format_string_t<Args...> fmt, Args &&... args)
|
|
|
|
|
{
|
|
|
|
|
bool log_enabled = should_log(lvl);
|
|
|
|
|
bool traceback_enabled = tracer_.enabled();
|
|
|
|
@ -368,11 +368,7 @@ protected:
|
|
|
|
|
SPDLOG_TRY
|
|
|
|
|
{
|
|
|
|
|
memory_buf_t buf;
|
|
|
|
|
#ifdef SPDLOG_USE_STD_FORMAT
|
|
|
|
|
fmt_lib::vformat_to(std::back_inserter(buf), fmt, fmt_lib::make_format_args(std::forward<Args>(args)...));
|
|
|
|
|
#else
|
|
|
|
|
fmt::vformat_to(fmt::appender(buf), fmt, fmt::make_format_args(std::forward<Args>(args)...));
|
|
|
|
|
#endif
|
|
|
|
|
fmt_lib::format_to(std::back_inserter(buf), fmt, std::forward<Args>(args)...);
|
|
|
|
|
|
|
|
|
|
details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()));
|
|
|
|
|
log_it_(log_msg, log_enabled, traceback_enabled);
|
|
|
|
@ -382,7 +378,7 @@ protected:
|
|
|
|
|
|
|
|
|
|
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
|
|
|
|
template<typename... Args>
|
|
|
|
|
void log_(source_loc loc, level::level_enum lvl, wstring_view_t fmt, Args &&... args)
|
|
|
|
|
void log_(source_loc loc, level::level_enum lvl, wformat_string_t<Args...> fmt, Args &&... args)
|
|
|
|
|
{
|
|
|
|
|
bool log_enabled = should_log(lvl);
|
|
|
|
|
bool traceback_enabled = tracer_.enabled();
|
|
|
|
@ -394,12 +390,7 @@ protected:
|
|
|
|
|
{
|
|
|
|
|
// format to wmemory_buffer and convert to utf8
|
|
|
|
|
wmemory_buf_t wbuf;
|
|
|
|
|
# ifdef SPDLOG_USE_STD_FORMAT
|
|
|
|
|
fmt_lib::vformat_to(
|
|
|
|
|
std::back_inserter(wbuf), fmt, fmt_lib::make_format_args<fmt_lib::wformat_context>(std::forward<Args>(args)...));
|
|
|
|
|
# else
|
|
|
|
|
fmt::vformat_to(std::back_inserter(wbuf), fmt, fmt::make_format_args<fmt::wformat_context>(std::forward<Args>(args)...));
|
|
|
|
|
# endif
|
|
|
|
|
fmt_lib::format_to(std::back_inserter(wbuf), fmt, std::forward<Args>(args)...);
|
|
|
|
|
|
|
|
|
|
memory_buf_t buf;
|
|
|
|
|
details::os::wstr_to_utf8buf(wstring_view_t(wbuf.data(), wbuf.size()), buf);
|
|
|
|
@ -408,27 +399,6 @@ protected:
|
|
|
|
|
}
|
|
|
|
|
SPDLOG_LOGGER_CATCH(loc)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// T can be statically converted to wstring_view, and no formatting needed.
|
|
|
|
|
template<class T, typename std::enable_if<std::is_convertible<const T &, spdlog::wstring_view_t>::value, int>::type = 0>
|
|
|
|
|
void log_(source_loc loc, level::level_enum lvl, const T &msg)
|
|
|
|
|
{
|
|
|
|
|
bool log_enabled = should_log(lvl);
|
|
|
|
|
bool traceback_enabled = tracer_.enabled();
|
|
|
|
|
if (!log_enabled && !traceback_enabled)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
SPDLOG_TRY
|
|
|
|
|
{
|
|
|
|
|
memory_buf_t buf;
|
|
|
|
|
details::os::wstr_to_utf8buf(msg, buf);
|
|
|
|
|
details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()));
|
|
|
|
|
log_it_(log_msg, log_enabled, traceback_enabled);
|
|
|
|
|
}
|
|
|
|
|
SPDLOG_LOGGER_CATCH(loc)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
|
|
|
|
|
|
|
|
|
// log the given message (if the given log level is high enough),
|
|
|
|
|