From d315bba1f8234b812a025be356a096d0df55da8f Mon Sep 17 00:00:00 2001 From: Oleksii Mandrychenko Date: Wed, 29 Mar 2017 16:06:59 +0100 Subject: [PATCH] Initialising members via constructor --- include/spdlog/details/logger_impl.h | 8 ++++---- include/spdlog/logger.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/spdlog/details/logger_impl.h b/include/spdlog/details/logger_impl.h index 5bb85f67..c712b27a 100644 --- a/include/spdlog/details/logger_impl.h +++ b/include/spdlog/details/logger_impl.h @@ -18,11 +18,11 @@ template inline spdlog::logger::logger(const std::string& logger_name, const It& begin, const It& end): _name(logger_name), _sinks(begin, end), - _formatter(std::make_shared("%+")) + _formatter(std::make_shared("%+")), + _level(level::info), + _flush_level(level::off), + _last_err_time(0) { - _level = level::info; - _flush_level = level::off; - _last_err_time = 0; _err_handler = [this](const std::string &msg) { this->_default_err_handler(msg); diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index aec1d203..58b4841a 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -87,7 +87,7 @@ protected: spdlog::level_t _level; spdlog::level_t _flush_level; log_err_handler _err_handler; - std::atomic _last_err_time {0}; // init atomic value to avoid reads of uninitialised memory + std::atomic _last_err_time; }; }