mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-13 01:10:26 +08:00
Removed swap from logger and renamed source location macro to SPDLOG_USE_SOURCE_LOCATION
This commit is contained in:
parent
5882bfd0ad
commit
af2f24de07
@ -29,38 +29,8 @@ SPDLOG_INLINE logger::logger(logger &&other) noexcept
|
|||||||
, level_(other.level_.load(std::memory_order_relaxed))
|
, level_(other.level_.load(std::memory_order_relaxed))
|
||||||
, flush_level_(other.flush_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_))
|
, custom_err_handler_(std::move(other.custom_err_handler_))
|
||||||
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SPDLOG_INLINE logger &logger::operator=(logger other) noexcept
|
|
||||||
{
|
|
||||||
this->swap(other);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_INLINE void logger::swap(spdlog::logger &other) noexcept
|
|
||||||
{
|
|
||||||
name_.swap(other.name_);
|
|
||||||
sinks_.swap(other.sinks_);
|
|
||||||
|
|
||||||
// swap level_
|
|
||||||
auto other_level = other.level_.load();
|
|
||||||
auto my_level = level_.exchange(other_level);
|
|
||||||
other.level_.store(my_level);
|
|
||||||
|
|
||||||
// swap flush level_
|
|
||||||
other_level = other.flush_level_.load();
|
|
||||||
my_level = flush_level_.exchange(other_level);
|
|
||||||
other.flush_level_.store(my_level);
|
|
||||||
|
|
||||||
custom_err_handler_.swap(other.custom_err_handler_);
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_INLINE void swap(logger &a, logger &b)
|
|
||||||
{
|
|
||||||
a.swap(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_INLINE void logger::set_level(level::level_enum log_level)
|
SPDLOG_INLINE void logger::set_level(level::level_enum log_level)
|
||||||
{
|
{
|
||||||
level_.store(log_level);
|
level_.store(log_level);
|
||||||
|
@ -70,12 +70,10 @@ public:
|
|||||||
: logger(std::move(name), sinks.begin(), sinks.end())
|
: logger(std::move(name), sinks.begin(), sinks.end())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~logger() = default;
|
|
||||||
|
|
||||||
logger(const logger &other) noexcept;
|
logger(const logger &other) noexcept;
|
||||||
logger(logger &&other) noexcept;
|
logger(logger &&other) noexcept;
|
||||||
logger &operator=(logger other) noexcept;
|
|
||||||
void swap(spdlog::logger &other) noexcept;
|
virtual ~logger() = default;
|
||||||
|
|
||||||
// log functions
|
// log functions
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@ -129,8 +127,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SPDLOG_EMIT_SOURCE_LOCATION
|
#ifdef SPDLOG_USE_SOURCE_LOCATION
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void trace(loc_with_fmt fmt, Args &&...args)
|
void trace(loc_with_fmt fmt, Args &&...args)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ void log(level::level_enum lvl, S fmt, Args &&...args)
|
|||||||
default_logger_raw()->log(lvl, fmt, std::forward<Args>(args)...);
|
default_logger_raw()->log(lvl, fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SPDLOG_EMIT_SOURCE_LOCATION
|
#ifdef SPDLOG_USE_SOURCE_LOCATION
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void trace(loc_with_fmt fmt, Args &&...args)
|
void trace(loc_with_fmt fmt, Args &&...args)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user