Merge pull request #2468 from JosJuice/honor-logging-startup
Honor logging settings at startup
This commit is contained in:
commit
d36df5b1b4
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue