From b710e0fe86dacc447690501d3f71661cce6aee69 Mon Sep 17 00:00:00 2001 From: gabime Date: Thu, 19 Jul 2018 15:00:05 +0300 Subject: [PATCH] Changed some functions to accept strings instead of ref to strings for better semantics --- include/spdlog/async_logger.h | 6 +++--- include/spdlog/details/async_logger_impl.h | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/spdlog/async_logger.h b/include/spdlog/async_logger.h index 4f0bf3f8..4a6eb768 100644 --- a/include/spdlog/async_logger.h +++ b/include/spdlog/async_logger.h @@ -33,13 +33,13 @@ class async_logger SPDLOG_FINAL : public std::enable_shared_from_this - async_logger(const std::string &logger_name, const It &begin, const It &end, std::weak_ptr tp, + async_logger(std::string logger_name, const It &begin, const It &end, std::weak_ptr tp, async_overflow_policy overflow_policy = async_overflow_policy::block); - async_logger(const std::string &logger_name, sinks_init_list sinks, std::weak_ptr tp, + async_logger(std::string logger_name, sinks_init_list sinks, std::weak_ptr tp, async_overflow_policy overflow_policy = async_overflow_policy::block); - async_logger(const std::string &logger_name, sink_ptr single_sink, std::weak_ptr tp, + async_logger(std::string logger_name, sink_ptr single_sink, std::weak_ptr tp, async_overflow_policy overflow_policy = async_overflow_policy::block); protected: diff --git a/include/spdlog/details/async_logger_impl.h b/include/spdlog/details/async_logger_impl.h index 77247ab7..6ddec901 100644 --- a/include/spdlog/details/async_logger_impl.h +++ b/include/spdlog/details/async_logger_impl.h @@ -15,23 +15,23 @@ #include template -inline spdlog::async_logger::async_logger(const std::string &logger_name, const It &begin, const It &end, +inline spdlog::async_logger::async_logger(std::string logger_name, const It &begin, const It &end, std::weak_ptr tp, async_overflow_policy overflow_policy) - : logger(logger_name, begin, end) + : logger(std::move(logger_name), begin, end) , thread_pool_(tp) , overflow_policy_(overflow_policy) { } -inline spdlog::async_logger::async_logger(const std::string &logger_name, sinks_init_list sinks_list, +inline spdlog::async_logger::async_logger(std::string logger_name, sinks_init_list sinks_list, std::weak_ptr tp, async_overflow_policy overflow_policy) - : async_logger(logger_name, sinks_list.begin(), sinks_list.end(), tp, overflow_policy) + : async_logger(std::move(logger_name), sinks_list.begin(), sinks_list.end(), tp, overflow_policy) { } inline spdlog::async_logger::async_logger( - const std::string &logger_name, sink_ptr single_sink, std::weak_ptr tp, async_overflow_policy overflow_policy) - : async_logger(logger_name, {single_sink}, tp, overflow_policy) + std::string logger_name, sink_ptr single_sink, std::weak_ptr tp, async_overflow_policy overflow_policy) + : async_logger(std::move(logger_name), {single_sink}, tp, overflow_policy) { }