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