m_queue_mutex_holder = 0;
}
- _flush(m_flush, true, false);
+ _flush(m_flush, false);
m_flush_mutex_holder = 0;
}
}
}
-void Log::_flush(EntryVector& t, bool requeue, bool crash)
+void Log::_flush(EntryVector& t, bool crash)
{
long len = 0;
+ if (t.empty()) {
+ assert(m_log_buf.empty());
+ return;
+ }
if (crash) {
len = t.size();
}
- if (!requeue && t.empty()) {
- return;
- }
for (auto& e : t) {
auto prio = e.m_prio;
auto stamp = e.m_stamp;
m_graylog->log_entry(e);
}
- if (requeue) {
- m_recent.push_back(std::move(e));
- }
+ m_recent.push_back(std::move(e));
}
t.clear();
m_queue_mutex_holder = 0;
}
- _flush(m_flush, true, false);
+ _flush(m_flush, false);
_flush_logbuf();
_log_message("--- begin dump of recent events ---", true);
EntryVector t;
t.insert(t.end(), std::make_move_iterator(m_recent.begin()), std::make_move_iterator(m_recent.end()));
m_recent.clear();
- _flush(t, true, true);
+ _flush(t, true);
}
char buf[4096];
void _log_safe_write(std::string_view sv);
void _flush_logbuf();
- void _flush(EntryVector& q, bool requeue, bool crash);
+ void _flush(EntryVector& q, bool crash);
void _log_message(const char *s, bool crash);