From 7b2ee9a9eeb3c148f8ebf64fcb7bf8972173fe2e Mon Sep 17 00:00:00 2001 From: gabime Date: Sat, 9 Nov 2024 11:34:18 +0200 Subject: [PATCH] Removed error counter from default error handler --- include/spdlog/logger-inl.h | 9 ++++----- include/spdlog/logger.h | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/spdlog/logger-inl.h b/include/spdlog/logger-inl.h index 3858105e..634c1697 100644 --- a/include/spdlog/logger-inl.h +++ b/include/spdlog/logger-inl.h @@ -174,16 +174,15 @@ SPDLOG_INLINE void logger::err_handler_(const std::string &msg) { } else { using std::chrono::system_clock; auto now = system_clock::now(); - auto err_counter_val = err_counter.fetch_add(1, std::memory_order_relaxed)+1; auto tm_time = details::os::localtime(system_clock::to_time_t(now)); char date_buf[64]; std::strftime(date_buf, sizeof(date_buf), "%Y-%m-%d %H:%M:%S", &tm_time); #if defined(USING_R) && defined(R_R_H) // if in R environment - REprintf("[*** LOG ERROR #%04zu ***] [%s] [%s] %s\n", - err_counter_val, date_buf, name().c_str(), msg.c_str()); + REprintf("[*** LOG ERROR ***] [%s] [%s] %s\n", + date_buf, name().c_str(), msg.c_str()); #else - std::fprintf(stderr, "[*** LOG ERROR #%04zu ***] [%s] [%s] %s\n", err_counter_val, date_buf, - name().c_str(), msg.c_str()); + std::fprintf(stderr, "[*** LOG ERROR ***] [%s] [%s] %s\n", + date_buf, name().c_str(), msg.c_str()); #endif } } diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index 34aa0c00..f49bdc00 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -311,7 +311,6 @@ protected: spdlog::level_t flush_level_{level::off}; err_handler custom_err_handler_{nullptr}; details::backtracer tracer_; - std::atomic err_counter{0}; // common implementation for after templated public api has been resolved template