mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-12 17:00:25 +08:00
Moved should_flush_ to header
This commit is contained in:
parent
3d83e402ca
commit
04004e57c2
@ -121,6 +121,11 @@ public:
|
||||
// return true if logging is enabled for the given level.
|
||||
[[nodiscard]] bool should_log(level msg_level) const { return msg_level >= level_.load(std::memory_order_relaxed); }
|
||||
|
||||
// return true if the given message should be flushed
|
||||
[[nodiscard]] bool should_flush(const details::log_msg &msg) const {
|
||||
return (msg.log_level >= flush_level_.load(std::memory_order_relaxed)) && (msg.log_level != level::off);
|
||||
}
|
||||
|
||||
// set the level of logging
|
||||
void set_level(level level);
|
||||
|
||||
@ -193,12 +198,11 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
if (should_flush_(msg)) {
|
||||
if (should_flush(msg)) {
|
||||
flush_();
|
||||
}
|
||||
}
|
||||
void flush_();
|
||||
[[nodiscard]] bool should_flush_(const details::log_msg &msg) const;
|
||||
};
|
||||
|
||||
} // namespace spdlog
|
||||
|
@ -81,10 +81,4 @@ void logger::flush_() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool logger::should_flush_(const details::log_msg &msg) const {
|
||||
const auto flush_level = flush_level_.load(std::memory_order_relaxed);
|
||||
return (msg.log_level >= flush_level) && (msg.log_level != level::off);
|
||||
}
|
||||
|
||||
} // namespace spdlog
|
||||
|
Loading…
Reference in New Issue
Block a user