Merge pull request #961 from RachelBryk/logs

Read the config file before enabling logs.
This commit is contained in:
shuffle2 2014-09-03 17:20:11 -07:00
commit 4fcb633df5
2 changed files with 15 additions and 6 deletions

View File

@ -13,6 +13,7 @@
#include "Core/Host.h"
#endif
#include "Common/FileUtil.h"
#include "Common/IniFile.h"
#include "Common/StringUtil.h"
#include "Common/Timer.h"
#include "Common/Logging/ConsoleListener.h"
@ -86,9 +87,16 @@ LogManager::LogManager()
m_consoleLog = new ConsoleListener();
m_debuggerLog = new DebuggerLogListener();
IniFile ini;
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
IniFile::Section* logs = ini.GetOrCreateSection("Logs");
for (LogContainer* container : m_Log)
{
container->SetEnable(true);
bool enable;
logs->Get(container->GetShortName(), &enable, false);
container->SetEnable(enable);
if (enable)
{
container->AddListener(m_fileLog);
container->AddListener(m_consoleLog);
#ifdef _MSC_VER
@ -96,6 +104,7 @@ LogManager::LogManager()
container->AddListener(m_debuggerLog);
#endif
}
}
}
LogManager::~LogManager()

View File

@ -103,7 +103,7 @@ void CLogWindow::CreateGUIControls()
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
bool enable;
logs->Get(m_LogManager->GetShortName((LogTypes::LOG_TYPE)i), &enable, true);
logs->Get(m_LogManager->GetShortName((LogTypes::LOG_TYPE)i), &enable, false);
if (m_writeWindow && enable)
m_LogManager->AddListener((LogTypes::LOG_TYPE)i, this);