Support for source location in async loggers

This commit is contained in:
gabime 2018-11-22 19:17:41 +02:00
parent a463989278
commit 521b0733d4
2 changed files with 13 additions and 2 deletions

View File

@ -197,8 +197,13 @@ struct source_loc
, line(line)
{
}
const char *const filename;
const uint32_t line;
//
// source_loc (const source_loc&) = default;
// source_loc& operator=(const source_loc&) = default;
// source_loc& operator=(source_loc&&) = default;
const char *filename;
uint32_t line;
};
namespace details {

View File

@ -33,6 +33,7 @@ struct async_msg
fmt::basic_memory_buffer<char, 176> raw;
size_t msg_id;
source_loc source;
async_logger_ptr worker_ptr;
async_msg() = default;
@ -49,6 +50,7 @@ struct async_msg
thread_id(other.thread_id),
raw(move(other.raw)),
msg_id(other.msg_id),
source(other.source),
worker_ptr(std::move(other.worker_ptr))
{
}
@ -61,6 +63,7 @@ struct async_msg
thread_id = other.thread_id;
raw = std::move(other.raw);
msg_id = other.msg_id;
source = other.source;
worker_ptr = std::move(other.worker_ptr);
return *this;
}
@ -76,6 +79,7 @@ struct async_msg
, time(m.time)
, thread_id(m.thread_id)
, msg_id(m.msg_id)
, source(m.source)
, worker_ptr(std::move(worker))
{
fmt_helper::append_string_view(m.payload, raw);
@ -87,6 +91,7 @@ struct async_msg
, time()
, thread_id(0)
, msg_id(0)
, source()
, worker_ptr(std::move(worker))
{
}
@ -103,6 +108,7 @@ struct async_msg
msg.time = time;
msg.thread_id = thread_id;
msg.msg_id = msg_id;
msg.source = source;
msg.color_range_start = 0;
msg.color_range_end = 0;
return msg;