This commit is contained in:
gabime 2014-12-02 02:27:11 +02:00
parent 4462a3c4e3
commit b0a687c148
3 changed files with 553 additions and 281 deletions

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,7 @@ struct log_msg
level(other.level), level(other.level),
time(other.time), time(other.time),
tm_time(other.tm_time) tm_time(other.tm_time)
{ {
raw.write(other.raw.data(), other.raw.size()); raw.write(other.raw.data(), other.raw.size());
formatted.write(other.formatted.data(), other.formatted.size()); formatted.write(other.formatted.data(), other.formatted.size());
} }
@ -61,7 +61,7 @@ struct log_msg
raw(std::move(other.raw)), raw(std::move(other.raw)),
formatted(std::move(other.formatted)) formatted(std::move(other.formatted))
{ {
other.clear(); other.clear();
} }
log_msg& operator=(log_msg&& other) log_msg& operator=(log_msg&& other)
@ -75,7 +75,7 @@ struct log_msg
tm_time = other.tm_time; tm_time = other.tm_time;
raw = std::move(other.raw); raw = std::move(other.raw);
formatted = std::move(other.formatted); formatted = std::move(other.formatted);
other.clear(); other.clear();
return *this; return *this;
} }
@ -83,7 +83,7 @@ struct log_msg
void clear() void clear()
{ {
level = level::OFF; level = level::OFF;
raw.clear(); raw.clear();
formatted.clear(); formatted.clear();
} }

View File

@ -112,7 +112,7 @@ inline void spdlog::sinks::async_sink::_sink_it(const details::log_msg& msg)
{ {
_push_sentry(); _push_sentry();
_q.push(std::move(msg)); _q.push(std::move(msg));
} }
inline void spdlog::sinks::async_sink::_thread_loop() inline void spdlog::sinks::async_sink::_thread_loop()
@ -131,9 +131,9 @@ inline void spdlog::sinks::async_sink::_thread_loop()
{ {
_formatter->format(msg); _formatter->format(msg);
for (auto &s : _sinks) for (auto &s : _sinks)
s->log(msg); s->log(msg);
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {