diff --git a/include/spdlog/async_logger-inl.h b/include/spdlog/async_logger-inl.h index a1c27a59..0fe01a03 100644 --- a/include/spdlog/async_logger-inl.h +++ b/include/spdlog/async_logger-inl.h @@ -7,6 +7,7 @@ # include #endif +#include #include #include @@ -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_();