Moved flush call to logger::_log_msg() function.

This commit is contained in:
Kevin M. Godby 2016-05-03 14:52:03 -05:00
parent 6b966478c1
commit d9ff5df830
2 changed files with 4 additions and 5 deletions

View File

@ -46,11 +46,6 @@ inline spdlog::details::line_logger::~line_logger()
#endif #endif
_callback_logger->_log_msg(_log_msg); _callback_logger->_log_msg(_log_msg);
} }
if (_log_msg.level >= _callback_logger->_flush_level)
{
_callback_logger->flush();
}
} }
// //

View File

@ -290,6 +290,10 @@ inline void spdlog::logger::_log_msg(details::log_msg& msg)
_formatter->format(msg); _formatter->format(msg);
for (auto &sink : _sinks) for (auto &sink : _sinks)
sink->log(msg); sink->log(msg);
const auto flush_level = _flush_level.load(std::memory_order_relaxed);
if (msg.level >= flush_level)
flush();
} }
inline void spdlog::logger::_set_pattern(const std::string& pattern) inline void spdlog::logger::_set_pattern(const std::string& pattern)