mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
Fixed dup sink compile warnings in older compilers with back_inserter
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include <spdlog/details/null_mutex.h>
|
||||
#include <spdlog/details/log_msg.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <cstdio>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
@@ -62,11 +62,14 @@ protected:
|
||||
|
||||
// log the "skipped.." message
|
||||
if (skip_counter_ > 0)
|
||||
{
|
||||
memory_buf_t buf;
|
||||
fmt::format_to(buf, "Skipped {} duplicate messages..", skip_counter_);
|
||||
details::log_msg skipped_msg{msg.logger_name, level::info, string_view_t{buf.data(), buf.size()}};
|
||||
dist_sink<Mutex>::sink_it_(skipped_msg);
|
||||
{
|
||||
char buf[64];
|
||||
auto msg_size = ::snprintf(buf, sizeof(buf), "Skipped %u duplicate messages..", static_cast<unsigned>(skip_counter_));
|
||||
if (msg_size > 0 && msg_size < sizeof(buf))
|
||||
{
|
||||
details::log_msg skipped_msg{msg.logger_name, level::info, string_view_t{buf, static_cast<size_t>(msg_size)}};
|
||||
dist_sink<Mutex>::sink_it_(skipped_msg);
|
||||
}
|
||||
}
|
||||
|
||||
// log current message
|
||||
|
Reference in New Issue
Block a user