mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-14 01:32:07 +08:00
async_log_helper minor fixes
This commit is contained in:
parent
61ab1af906
commit
7cc884fe34
@ -65,27 +65,8 @@ class async_log_helper
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
async_msg(async_msg &&other) SPDLOG_NOEXCEPT : logger_name(std::move(other.logger_name)),
|
async_msg(async_msg &&other) = default;
|
||||||
level(std::move(other.level)),
|
async_msg &operator=(async_msg &&other) = default;
|
||||||
time(std::move(other.time)),
|
|
||||||
thread_id(other.thread_id),
|
|
||||||
txt(std::move(other.txt)),
|
|
||||||
msg_type(std::move(other.msg_type)),
|
|
||||||
msg_id(other.msg_id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
async_msg &operator=(async_msg &&other) SPDLOG_NOEXCEPT
|
|
||||||
{
|
|
||||||
logger_name = std::move(other.logger_name);
|
|
||||||
level = other.level;
|
|
||||||
time = std::move(other.time);
|
|
||||||
thread_id = other.thread_id;
|
|
||||||
txt = std::move(other.txt);
|
|
||||||
msg_type = other.msg_type;
|
|
||||||
msg_id = other.msg_id;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// never copy or assign. should only be moved..
|
// never copy or assign. should only be moved..
|
||||||
async_msg(const async_msg &) = delete;
|
async_msg(const async_msg &) = delete;
|
||||||
@ -112,6 +93,7 @@ class async_log_helper
|
|||||||
msg.level = level;
|
msg.level = level;
|
||||||
msg.time = time;
|
msg.time = time;
|
||||||
msg.thread_id = thread_id;
|
msg.thread_id = thread_id;
|
||||||
|
msg.raw.clear();
|
||||||
msg.raw << txt;
|
msg.raw << txt;
|
||||||
msg.msg_id = msg_id;
|
msg.msg_id = msg_id;
|
||||||
}
|
}
|
||||||
@ -309,15 +291,13 @@ inline bool spdlog::details::async_log_helper::process_next_msg()
|
|||||||
s->log(incoming_log_msg);
|
s->log(incoming_log_msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handle_flush_interval();
|
handle_flush_interval();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
assert(false);
|
assert(false);
|
||||||
return true; // should not be reached
|
return true; // should not be reached
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline void spdlog::details::async_log_helper::set_formatter(formatter_ptr msg_formatter)
|
inline void spdlog::details::async_log_helper::set_formatter(formatter_ptr msg_formatter)
|
||||||
{
|
{
|
||||||
_formatter = std::move(msg_formatter);
|
_formatter = std::move(msg_formatter);
|
||||||
@ -328,7 +308,6 @@ inline void spdlog::details::async_log_helper::set_error_handler(spdlog::log_err
|
|||||||
_err_handler = std::move(err_handler);
|
_err_handler = std::move(err_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// flush all sinks if _flush_interval_ms has expired.
|
// flush all sinks if _flush_interval_ms has expired.
|
||||||
inline void spdlog::details::async_log_helper::handle_flush_interval()
|
inline void spdlog::details::async_log_helper::handle_flush_interval()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user