Fixed clang-tidy warning about implicit conversion to string_view

This commit is contained in:
gabime 2018-10-19 17:12:02 +03:00
parent c2a9bf9974
commit 70bef682b0
5 changed files with 5 additions and 10 deletions

View File

@ -45,11 +45,6 @@ struct log_msg
mutable size_t color_range_start{0}; mutable size_t color_range_start{0};
mutable size_t color_range_end{0}; mutable size_t color_range_end{0};
operator fmt::string_view() const SPDLOG_NOEXCEPT
{
return payload;
}
const fmt::string_view payload; const fmt::string_view payload;
}; };
} // namespace details } // namespace details

View File

@ -404,7 +404,7 @@ class v_formatter final : public flag_formatter
{ {
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
{ {
fmt_helper::append_string_view(msg, dest); fmt_helper::append_string_view(msg.payload, dest);
} }
}; };
@ -530,7 +530,7 @@ class full_formatter final : public flag_formatter
dest.push_back(']'); dest.push_back(']');
dest.push_back(' '); dest.push_back(' ');
// fmt_helper::append_string_view(msg.msg(), dest); // fmt_helper::append_string_view(msg.msg(), dest);
fmt_helper::append_string_view(msg, dest); fmt_helper::append_string_view(msg.payload, dest);
} }
private: private:

View File

@ -78,7 +78,7 @@ struct async_msg
, msg_id(m.msg_id) , msg_id(m.msg_id)
, worker_ptr(std::move(worker)) , worker_ptr(std::move(worker))
{ {
fmt_helper::append_string_view(m, raw); fmt_helper::append_string_view(m.payload, raw);
} }
async_msg(async_logger_ptr &&worker, async_msg_type the_type) async_msg(async_logger_ptr &&worker, async_msg_type the_type)

View File

@ -47,7 +47,7 @@ protected:
fmt::memory_buffer formatted; fmt::memory_buffer formatted;
if (use_raw_msg_) if (use_raw_msg_)
{ {
details::fmt_helper::append_string_view(msg, formatted); details::fmt_helper::append_string_view(msg.payload, formatted);
} }
else else
{ {

View File

@ -53,7 +53,7 @@ public:
protected: protected:
void sink_it_(const details::log_msg &msg) override void sink_it_(const details::log_msg &msg) override
{ {
::syslog(syslog_prio_from_level(msg), "%s", fmt::to_string(msg).c_str()); ::syslog(syslog_prio_from_level(msg), "%s", fmt::to_string(msg.payload).c_str());
} }
void flush_() override {} void flush_() override {}