added level_t to sink. Improves the flexibility of loggers with multiple sinks

This commit is contained in:
davide
2016-09-12 22:26:38 +02:00
parent c69df8ae44
commit b67076fc85
5 changed files with 41 additions and 8 deletions

View File

@@ -245,8 +245,11 @@ inline bool spdlog::logger::should_log(spdlog::level::level_enum msg_level) cons
inline void spdlog::logger::_sink_it(details::log_msg& msg)
{
_formatter->format(msg);
for (auto &sink : _sinks)
sink->log(msg);
for (auto &sink : _sinks){
if( sink->should_log( msg.level)){
sink->log(msg);
}
}
if(_should_flush_on(msg))
flush();