feat: Add logging of dropped messages

pull/2483/head
Aleksandar Levic 3 years ago
parent f44fa31f51
commit 0299517fc8

@ -7,6 +7,7 @@
# include <spdlog/async_logger.h>
#endif
#include <spdlog/spdlog.h>
#include <spdlog/sinks/sink.h>
#include <spdlog/details/thread_pool.h>
@ -66,6 +67,15 @@ SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg
}
}
if (auto pool_ptr = thread_pool_.lock())
{
auto lost_messages = pool_ptr->overrun_counter();
if (lost_messages > 0) {
spdlog::warn("Lost {} messages.", lost_messages);
pool_ptr->reset_overrun_counter();
}
}
if (should_flush_(msg))
{
backend_flush_();

Loading…
Cancel
Save