#ifndef LOGGER_H_INCLUDED_ #define LOGGER_H_INCLUDED_ #include "kblib/stringops.h" namespace detail { auto log(std::string_view str) -> void; } // namespace detail enum class log_level { silent = 0, err = 1, warn = 2, notice = 3, info = 4, debug = 5, }; auto set_log_level(log_level) -> void; auto get_log_level() -> log_level; auto set_log_output(std::ostream&) -> void; auto set_log_output(const std::ostream&&) -> void = delete; template auto log_debug(Strings&&... strings) -> void { if (get_log_level() >= log_level::debug) { detail::log(kblib::concat("DEBUG: ", strings...)); } } template auto log_info(Strings&&... strings) -> void { if (get_log_level() >= log_level::info) { detail::log(kblib::concat("INFO: ", strings...)); } } template auto log_notice(Strings&&... strings) -> void { if (get_log_level() >= log_level::notice) { detail::log(kblib::concat("NOTICE: ", strings...)); } } template auto log_warn(Strings&&... strings) -> void { if (get_log_level() >= log_level::warn) { detail::log(kblib::concat("WARN: ", strings...)); } } template auto log_err(Strings&&... strings) -> void { if (get_log_level() >= log_level::err) { detail::log(kblib::concat("ERROR: ", strings...)); } } #endif // LOGGER_H_INCLUDED_