Disable log console by default, add a setting in LogManager settings section to enable it

This commit is contained in:
Adam Honse 2021-10-06 19:16:11 -05:00
parent 77b924d5f7
commit b94663aa03
3 changed files with 30 additions and 3 deletions

View file

@ -14,6 +14,7 @@ const char* LogManager::log_codes[] = {"FATAL:", "ERROR:", "Warning:", "Info:",
LogManager::LogManager()
{
base_clock = std::chrono::steady_clock::now();
log_console_enabled = false;
}
LogManager* LogManager::get()
@ -118,6 +119,14 @@ void LogManager::configure(json config, const std::string &defaultDir)
}
}
/*-------------------------------------------------*\
| Check log console configuration |
\*-------------------------------------------------*/
if(config.contains("log_console"))
{
log_console_enabled = config["log_console"];
}
/*-------------------------------------------------*\
| Flush the log |
\*-------------------------------------------------*/
@ -224,7 +233,10 @@ void LogManager::_append(const char* filename, int line, unsigned int level, con
\*-------------------------------------------------*/
temp_messages.push_back(mes);
all_messages.push_back(mes);
if(log_console_enabled)
{
all_messages.push_back(mes);
}
/*-------------------------------------------------*\
| Flush the queues |