Merge pull request #2468 from JosJuice/honor-logging-startup

Honor logging settings at startup
This commit is contained in:
flacs 2015-06-01 23:56:15 +02:00
commit d36df5b1b4
1 changed files with 8 additions and 3 deletions

View File

@ -89,16 +89,21 @@ LogManager::LogManager()
IniFile ini;
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
IniFile::Section* logs = ini.GetOrCreateSection("Logs");
IniFile::Section* options = ini.GetOrCreateSection("Options");
bool write_file;
bool write_console;
options->Get("WriteToFile", &write_file, false);
options->Get("WriteToConsole", &write_console, true);
for (LogContainer* container : m_Log)
{
bool enable;
logs->Get(container->GetShortName(), &enable, false);
container->SetEnable(enable);
if (enable)
{
if (enable && write_file)
container->AddListener(m_fileLog);
if (enable && write_console)
container->AddListener(m_consoleLog);
}
}
}