|
|
|
@ -11,8 +11,58 @@
|
|
|
|
|
#include "spdlog/details/pattern_formatter.h"
|
|
|
|
|
|
|
|
|
|
namespace spdlog {
|
|
|
|
|
|
|
|
|
|
// public methods
|
|
|
|
|
SPDLOG_INLINE void logger::log(source_loc loc, level::level_enum lvl, const char *msg)
|
|
|
|
|
SPDLOG_INLINE logger::logger(const logger &other):
|
|
|
|
|
name_(other.name_),
|
|
|
|
|
sinks_(other.sinks_),
|
|
|
|
|
level_(other.level_.load(std::memory_order_relaxed)),
|
|
|
|
|
flush_level_(other.flush_level_.load(std::memory_order_relaxed)),
|
|
|
|
|
custom_err_handler_(other.custom_err_handler_)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SPDLOG_INLINE logger::logger(logger &&other):
|
|
|
|
|
name_(std::move(other.name_)),
|
|
|
|
|
sinks_(std::move(other.sinks_)),
|
|
|
|
|
level_(other.level_.load(std::memory_order_relaxed)),
|
|
|
|
|
flush_level_(other.flush_level_.load(std::memory_order_relaxed)),
|
|
|
|
|
custom_err_handler_(std::move(other.custom_err_handler_))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SPDLOG_INLINE logger &logger::operator=(logger other)
|
|
|
|
|
{
|
|
|
|
|
this->swap(other);
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SPDLOG_INLINE void logger::swap(spdlog::logger &other)
|
|
|
|
|
{
|
|
|
|
|
name_.swap(other.name_);
|
|
|
|
|
sinks_.swap(other.sinks_);
|
|
|
|
|
|
|
|
|
|
//swap level_
|
|
|
|
|
auto tmp = other.level_.load();
|
|
|
|
|
tmp = level_.exchange(tmp);
|
|
|
|
|
other.level_.store(tmp);
|
|
|
|
|
|
|
|
|
|
//swap flush level_
|
|
|
|
|
tmp = other.flush_level_.load();
|
|
|
|
|
tmp = flush_level_.exchange(tmp);
|
|
|
|
|
other.flush_level_.store(tmp);
|
|
|
|
|
|
|
|
|
|
custom_err_handler_.swap(other.custom_err_handler_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SPDLOG_INLINE void swap(logger &a, logger &b)
|
|
|
|
|
{
|
|
|
|
|
a.swap(b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void logger::log(source_loc loc, level::level_enum lvl, const char *msg)
|
|
|
|
|
{
|
|
|
|
|
if (!should_log(lvl))
|
|
|
|
|
{
|
|
|
|
@ -135,10 +185,8 @@ SPDLOG_INLINE void logger::set_error_handler(err_handler handler)
|
|
|
|
|
// create new logger with same sinks and configuration.
|
|
|
|
|
SPDLOG_INLINE std::shared_ptr<logger> logger::clone(std::string logger_name)
|
|
|
|
|
{
|
|
|
|
|
auto cloned = std::make_shared<logger>(std::move(logger_name), sinks_.begin(), sinks_.end());
|
|
|
|
|
cloned->set_level(this->level());
|
|
|
|
|
cloned->flush_on(this->flush_level());
|
|
|
|
|
cloned->set_error_handler(this->custom_err_handler_);
|
|
|
|
|
auto cloned = std::make_shared<logger>(*this);
|
|
|
|
|
cloned->name_ = std::move(logger_name);
|
|
|
|
|
return cloned;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|