mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
Better support for logger copy with backtrace
This commit is contained in:
parent
13e9135935
commit
c55336e78d
@ -25,7 +25,11 @@ public:
|
||||
: n_messages_{n_messages}, messages_{n_messages}
|
||||
{}
|
||||
|
||||
size_t n_messages()
|
||||
backtracer(const backtracer &other):
|
||||
n_messages_{other.n_messages_}, messages_{other.messages_}
|
||||
{}
|
||||
|
||||
size_t n_messages() const
|
||||
{
|
||||
return n_messages_;
|
||||
}
|
||||
|
@ -32,6 +32,14 @@ public:
|
||||
update_string_views();
|
||||
}
|
||||
|
||||
log_msg_buffer(const log_msg_buffer &other)
|
||||
: log_msg{other}
|
||||
{
|
||||
buffer.append(logger_name.begin(), logger_name.end());
|
||||
buffer.append(payload.begin(), payload.end());
|
||||
update_string_views();
|
||||
}
|
||||
|
||||
log_msg_buffer(log_msg_buffer &&other)
|
||||
: log_msg{std::move(other)}
|
||||
, buffer{std::move(other.buffer)}
|
||||
|
@ -22,11 +22,10 @@ SPDLOG_INLINE logger::logger(const logger &other)
|
||||
, 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_)
|
||||
, tracer_(other.tracer_)
|
||||
{
|
||||
if(other.tracer_)
|
||||
{
|
||||
enable_backtrace(other.tracer_->n_messages());
|
||||
tracer_ = std::make_shared<details::backtracer>(*other.tracer_);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user