Use stack allocated space when possible

This commit is contained in:
Charles Milette
2019-06-30 21:34:19 -04:00
parent 3bcd3cef2f
commit f529afa625
3 changed files with 20 additions and 12 deletions

View File

@@ -244,8 +244,10 @@ public:
fmt::wmemory_buffer wbuf;
fmt::format_to(wbuf, fmt, args...);
const auto payload = details::os::wstr_to_str({ wbuf.data(), wbuf.size() });
details::log_msg log_msg(source, name_, lvl, payload);
fmt::memory_buffer buf;
details::os::wstr_to_utf8buf(basic_string_view_t<wchar_t>(wbuf.data(), wbuf.size()), buf);
details::log_msg log_msg(source, name_, lvl, string_view_t(buf.data(), buf.size()));
sink_it_(log_msg);
}
catch (const std::exception &ex)