diff options
Diffstat (limited to 'src/crepe/util/log.cpp')
-rw-r--r-- | src/crepe/util/log.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/crepe/util/log.cpp b/src/crepe/util/log.cpp index f012c67..e3e9f1f 100644 --- a/src/crepe/util/log.cpp +++ b/src/crepe/util/log.cpp @@ -5,17 +5,22 @@ #include "fmt.h" #include "log.h" +#include "../api/Config.h" using namespace crepe::util; static const char * const LOG_PREFIX[] = { - [log_level::DEBUG] = "[DBG] ", + [log_level::TRACE] = "[TRACE] ", + [log_level::DEBUG] = "[DEBUG] ", [log_level::INFO] = "[INFO] ", [log_level::WARNING] = "[WARN] ", - [log_level::ERROR] = "[ERR] ", + [log_level::ERROR] = "[ERROR] ", }; static void log(enum log_level level, const std::string msg) { + auto & cfg = crepe::api::Config::get_instance(); + if (level < cfg.log.level) return; + using namespace std; string final = string(LOG_PREFIX[level]) + msg; if (!final.ends_with("\n")) final += "\n"; @@ -38,3 +43,4 @@ void crepe::util::logf(log_level level, const char * fmt, ...) { log(level, va_stringf(args, fmt)); va_end(args); } + |