add functions to change logging settings (global\!)

v1
Brett 2023-07-21 16:52:44 -04:00
parent b9b501d391
commit 7e1007526f
1 changed files with 18 additions and 1 deletions

View File

@ -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 <iostream>
@ -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();