mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-13 09:20:25 +08:00
Initialising members via constructor
This commit is contained in:
parent
b5d838cc32
commit
d315bba1f8
@ -18,11 +18,11 @@ template<class It>
|
|||||||
inline spdlog::logger::logger(const std::string& logger_name, const It& begin, const It& end):
|
inline spdlog::logger::logger(const std::string& logger_name, const It& begin, const It& end):
|
||||||
_name(logger_name),
|
_name(logger_name),
|
||||||
_sinks(begin, end),
|
_sinks(begin, end),
|
||||||
_formatter(std::make_shared<pattern_formatter>("%+"))
|
_formatter(std::make_shared<pattern_formatter>("%+")),
|
||||||
|
_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)
|
_err_handler = [this](const std::string &msg)
|
||||||
{
|
{
|
||||||
this->_default_err_handler(msg);
|
this->_default_err_handler(msg);
|
||||||
|
@ -87,7 +87,7 @@ protected:
|
|||||||
spdlog::level_t _level;
|
spdlog::level_t _level;
|
||||||
spdlog::level_t _flush_level;
|
spdlog::level_t _flush_level;
|
||||||
log_err_handler _err_handler;
|
log_err_handler _err_handler;
|
||||||
std::atomic<time_t> _last_err_time {0}; // init atomic value to avoid reads of uninitialised memory
|
std::atomic<time_t> _last_err_time;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user