change the logger's sink_it_ parameter from lvalue reference to rvalue reference

pull/889/head
rwen2012 7 years ago
parent e35414a0f1
commit 4f2ce074be

@ -58,7 +58,7 @@ public:
std::shared_ptr<logger> clone(std::string new_name) override;
protected:
void sink_it_(details::log_msg &msg) override;
void sink_it_(details::log_msg &&msg) override;
void flush_() override;
void backend_log_(const details::log_msg &incoming_log_msg);

@ -36,7 +36,7 @@ inline spdlog::async_logger::async_logger(
}
// send the log message to the thread pool
inline void spdlog::async_logger::sink_it_(details::log_msg &msg)
inline void spdlog::async_logger::sink_it_(details::log_msg &&msg)
{
#if defined(SPDLOG_ENABLE_MESSAGE_COUNTER)
incr_msg_counter_(msg);

@ -67,7 +67,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const char *fmt, const Ar
fmt::memory_buffer buf;
fmt::format_to(buf, fmt, args...);
details::log_msg log_msg(&name_, lvl, to_string_view(buf));
sink_it_(log_msg);
sink_it_(std::move(log_msg));
}
SPDLOG_CATCH_AND_HANDLE
}
@ -82,7 +82,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const char *msg)
try
{
details::log_msg log_msg(&name_, lvl, spdlog::string_view_t(msg));
sink_it_(log_msg);
sink_it_(std::move(log_msg));
}
SPDLOG_CATCH_AND_HANDLE
}
@ -97,7 +97,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const T &msg)
try
{
details::log_msg log_msg(&name_, lvl, msg);
sink_it_(log_msg);
sink_it_(std::move(log_msg));
}
SPDLOG_CATCH_AND_HANDLE
}
@ -115,7 +115,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const T &msg)
fmt::memory_buffer buf;
fmt::format_to(buf, "{}", msg);
details::log_msg log_msg(&name_, lvl, to_string_view(buf));
sink_it_(log_msg);
sink_it_(std::move(log_msg));
}
SPDLOG_CATCH_AND_HANDLE
}
@ -337,7 +337,7 @@ inline bool spdlog::logger::should_log(spdlog::level::level_enum msg_level) cons
// protected virtual called at end of each user log call (if enabled) by the
// line_logger
//
inline void spdlog::logger::sink_it_(details::log_msg &msg)
inline void spdlog::logger::sink_it_(details::log_msg &&msg)
{
#if defined(SPDLOG_ENABLE_MESSAGE_COUNTER)
incr_msg_counter_(msg);

@ -146,7 +146,7 @@ public:
virtual std::shared_ptr<logger> clone(std::string logger_name);
protected:
virtual void sink_it_(details::log_msg &msg);
virtual void sink_it_(details::log_msg &&msg);
virtual void flush_();
bool should_flush_(const details::log_msg &msg);

Loading…
Cancel
Save