mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 01:51:38 +08:00
Fixed logger's copy ctor
This commit is contained in:
parent
72b0f9e8f7
commit
11e9752536
@ -17,13 +17,19 @@ namespace details {
|
||||
class backtracer
|
||||
{
|
||||
std::mutex mutex_;
|
||||
size_t n_messages_;
|
||||
circular_q<log_msg_buffer> messages_;
|
||||
|
||||
public:
|
||||
explicit backtracer(size_t n_message)
|
||||
: messages_{n_message}
|
||||
explicit backtracer(size_t n_messages)
|
||||
: n_messages_{n_messages}, messages_{n_messages}
|
||||
{}
|
||||
|
||||
size_t n_messages()
|
||||
{
|
||||
return n_messages_;
|
||||
}
|
||||
|
||||
void add(const log_msg &msg)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{mutex_};
|
||||
|
@ -23,7 +23,12 @@ SPDLOG_INLINE logger::logger(const logger &other)
|
||||
, flush_level_(other.flush_level_.load(std::memory_order_relaxed))
|
||||
, custom_err_handler_(other.custom_err_handler_)
|
||||
, tracer_(other.tracer_)
|
||||
{}
|
||||
{
|
||||
if(other.tracer_)
|
||||
{
|
||||
enable_backtrace(other.tracer_->n_messages());
|
||||
}
|
||||
}
|
||||
|
||||
SPDLOG_INLINE logger::logger(logger &&other) SPDLOG_NOEXCEPT : name_(std::move(other.name_)),
|
||||
sinks_(std::move(other.sinks_)),
|
||||
|
Loading…
Reference in New Issue
Block a user