Automatically flush log if message level is above certain severity.

This commit is contained in:
Kevin M. Godby
2016-05-02 17:23:12 -05:00
parent 0143d9a92d
commit 6b966478c1
3 changed files with 15 additions and 0 deletions

View File

@@ -41,6 +41,9 @@ public:
const std::string& name() const;
bool should_log(level::level_enum) const;
// automatically call flush() after a message of level log_level or higher is emitted
void flush_on(level::level_enum log_level);
// logger.info(cppformat_string, arg1, arg2, arg3, ...) call style
template <typename... Args> details::line_logger trace(const char* fmt, const Args&... args);
template <typename... Args> details::line_logger debug(const char* fmt, const Args&... args);
@@ -104,6 +107,7 @@ protected:
std::vector<sink_ptr> _sinks;
formatter_ptr _formatter;
spdlog::level_t _level;
spdlog::level_t _flush_level;
};
}