8 enum class log_level : uint8_t{
19 std::size_t operator()(T t)
const
20 {
return static_cast<std::size_t
>(t); }
24 #if defined(LOGGING_LEVEL_ALL) || defined(LOGGING_LEVEL_TRACE)
25 constexpr log_level LOG_LEVEL_CUTOFF = log_level::TRACE;
26 #elif defined(LOGGING_LEVEL_DEBUG)
27 constexpr log_level LOG_LEVEL_CUTOFF = log_level::DEBUG;
28 #elif defined(LOGGING_LEVEL_WARN)
29 constexpr log_level LOG_LEVEL_CUTOFF = log_level::WARN;
30 #elif defined(LOGGING_LEVEL_ERROR)
31 constexpr log_level LOG_LEVEL_CUTOFF = log_level::ERR;
32 #elif defined(LOGGING_LEVEL_NONE)
33 constexpr log_level LOG_LEVEL_CUTOFF = log_level::ERR + 1;
35 constexpr log_level LOG_LEVEL_CUTOFF = log_level::INFO;
41 const std::unordered_map<log_level, std::string, enum_hasher> uncolored{
42 {log_level::ERR,
" [ERROR] "},
43 {log_level::WARN,
" [WARN] "},
44 {log_level::INFO,
" [INFO] "},
45 {log_level::TIME,
" [TIME] "},
46 {log_level::DEBUG,
" [DEBUG] "},
47 {log_level::TRACE,
" [TRACE] "}
53 const std::unordered_map<log_level, std::string, enum_hasher> colored{
54 {log_level::ERR,
" \x1b[31;1m[ERROR]\x1b[0m "},
55 {log_level::WARN,
" \x1b[33;1m[WARN]\x1b[0m "},
56 {log_level::INFO,
" \x1b[32;1m[INFO]\x1b[0m "},
57 {log_level::TIME,
" \x1b[36;1m[TIME]\x1b[0m "},
58 {log_level::DEBUG,
" \x1b[34;1m[DEBUG]\x1b[0m "},
59 {log_level::TRACE,
" \x1b[37;1m[TRACE]\x1b[0m "}
63 using logging_config_t = std::unordered_map<std::string, std::string>;
void INFO(const std::string &message)
Default info messages logging function.
Definition: logging.hpp:232
void ERR(const std::string &message)
Default error messages logging function.
Definition: logging.hpp:256
void TIME(const std::string &message)
Default time messages loggin function.
Definition: logging.hpp:240
void TRACE(const std::string &message)
Default trace messages logging function.
Definition: logging.hpp:216
void WARN(const std::string &message)
Default warning messages logging function.
Definition: logging.hpp:248
void DEBUG(const std::string &message)
Default debug messages logging function.
Definition: logging.hpp:224
Definition: logging_common.hpp:17