Commit 11e97525 authored by gabime's avatar gabime

Fixed logger's copy ctor

parent 72b0f9e8
......@@ -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_)),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment