diff options
author | Lucas CHOLLET <lucas.chollet@free.fr> | 2022-07-17 19:36:11 +0300 |
---|---|---|
committer | Lucas CHOLLET <lucas.chollet@free.fr> | 2022-07-17 21:28:39 +0300 |
commit | dfe1009080f39630a4931c46dc1e7f67bdb21ed9 (patch) | |
tree | 76b887d74bf3c47abcf9cd9b6c2c2eee81d932d0 /include/spdlog/spdlog.h | |
parent | 6c95f4c8168401badff89d0c16e3887ea91ea9ad (diff) |
Expend support for any std::chrono::duration in `spdlog::flush_every`
This allows things like:
spdlog::flush_every(std::chrono::minutes(10));
spdlog::flush_every(std::chrono::milliseconds(100));
Diffstat (limited to 'include/spdlog/spdlog.h')
-rw-r--r-- | include/spdlog/spdlog.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 65d3e9d5..8facbdcd 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -81,7 +81,11 @@ SPDLOG_API void flush_on(level::level_enum log_level); // Start/Restart a periodic flusher thread // Warning: Use only if all your loggers are thread safe! -SPDLOG_API void flush_every(std::chrono::seconds interval); +template<typename Rep, typename Period> +inline void flush_every(std::chrono::duration<Rep, Period> interval) +{ + details::registry::instance().flush_every(interval); +} // Set global error handler SPDLOG_API void set_error_handler(void (*handler)(const std::string &msg)); |