Merge pull request #961 from RachelBryk/logs
Read the config file before enabling logs.
This commit is contained in:
commit
4fcb633df5
|
@ -13,6 +13,7 @@
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#endif
|
#endif
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
|
#include "Common/IniFile.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Common/Timer.h"
|
#include "Common/Timer.h"
|
||||||
#include "Common/Logging/ConsoleListener.h"
|
#include "Common/Logging/ConsoleListener.h"
|
||||||
|
@ -86,15 +87,23 @@ LogManager::LogManager()
|
||||||
m_consoleLog = new ConsoleListener();
|
m_consoleLog = new ConsoleListener();
|
||||||
m_debuggerLog = new DebuggerLogListener();
|
m_debuggerLog = new DebuggerLogListener();
|
||||||
|
|
||||||
|
IniFile ini;
|
||||||
|
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
|
||||||
|
IniFile::Section* logs = ini.GetOrCreateSection("Logs");
|
||||||
for (LogContainer* container : m_Log)
|
for (LogContainer* container : m_Log)
|
||||||
{
|
{
|
||||||
container->SetEnable(true);
|
bool enable;
|
||||||
container->AddListener(m_fileLog);
|
logs->Get(container->GetShortName(), &enable, false);
|
||||||
container->AddListener(m_consoleLog);
|
container->SetEnable(enable);
|
||||||
|
if (enable)
|
||||||
|
{
|
||||||
|
container->AddListener(m_fileLog);
|
||||||
|
container->AddListener(m_consoleLog);
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
if (IsDebuggerPresent())
|
if (IsDebuggerPresent())
|
||||||
container->AddListener(m_debuggerLog);
|
container->AddListener(m_debuggerLog);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ void CLogWindow::CreateGUIControls()
|
||||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||||
{
|
{
|
||||||
bool enable;
|
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)
|
if (m_writeWindow && enable)
|
||||||
m_LogManager->AddListener((LogTypes::LOG_TYPE)i, this);
|
m_LogManager->AddListener((LogTypes::LOG_TYPE)i, this);
|
||||||
|
|
Loading…
Reference in New Issue