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

This commit is contained in:
Adam Honse committed 2021-10-06 19:16:11 -05:00
1 parent 77b924d5f7
commit b94663aa03
3 files changed
+30 -3

No files matched your search

+13 -1
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 |