From 217ad75ebd607f60164a28c4d8e8d1d57194de35 Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 20 Apr 2018 13:02:21 +0300 Subject: [PATCH] Fixed deault error handler not to use sink but write directly to stderr --- include/spdlog/details/logger_impl.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/spdlog/details/logger_impl.h b/include/spdlog/details/logger_impl.h index ddbcb875..213fdeda 100644 --- a/include/spdlog/details/logger_impl.h +++ b/include/spdlog/details/logger_impl.h @@ -344,13 +344,11 @@ inline void spdlog::logger::_default_err_handler(const std::string &msg) { return; } + _last_err_time = now; auto tm_time = details::os::localtime(now); char date_buf[100]; std::strftime(date_buf, sizeof(date_buf), "%Y-%m-%d %H:%M:%S", &tm_time); - details::log_msg err_msg; - err_msg.formatted.write("[*** LOG ERROR ***] [{}] [{}] [{}]{}", name(), msg, date_buf, details::os::default_eol); - sinks::stderr_sink_mt::instance()->log(err_msg); - _last_err_time = now; + fmt::print(stderr, "[*** LOG ERROR ***] [{}] [{}] {}\n", date_buf, name(), msg); } inline bool spdlog::logger::_should_flush_on(const details::log_msg &msg)