From 7e1007526f3fa7aecfb8027361bf900cdef23b91 Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 21 Jul 2023 16:52:44 -0400 Subject: [PATCH] add functions to change logging settings (global\!) --- include/blt/std/logging.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/include/blt/std/logging.h b/include/blt/std/logging.h index 5934b9c..8f661d8 100755 --- a/include/blt/std/logging.h +++ b/include/blt/std/logging.h @@ -125,9 +125,13 @@ namespace blt::logging { void flush(); void setThreadName(const std::string& name); + void setLogFormat(const log_format& format); + void setLogColor(log_level level, const std::string& newFormat); + void setLogName(log_level level, const std::string& newFormat); + void setLogOutputFormat(const std::string& newFormat); } -//#define BLT_LOGGING_IMPLEMENTATION +#define BLT_LOGGING_IMPLEMENTATION #ifdef BLT_LOGGING_IMPLEMENTATION #include @@ -457,6 +461,19 @@ namespace blt::logging { loggingThreadNames[std::this_thread::get_id()] = name; } + void setLogFormat(const log_format& format){ + loggingFormat = format; + } + void setLogColor(log_level level, const std::string& newFormat){ + loggingFormat.levelColors[(int)level] = newFormat; + } + void setLogName(log_level level, const std::string& newFormat){ + loggingFormat.levelNames[(int)level] = newFormat; + } + void setLogOutputFormat(const std::string& newFormat){ + loggingFormat.logOutputFormat = newFormat; + } + void flush() { std::cerr.flush(); std::cout.flush();