From 22d2c7d0533bf7b82163e452f536647b0bb32c66 Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Wed, 3 Sep 2014 19:48:54 -0400 Subject: [PATCH] Read the config file before enabling logs. --- Source/Core/Common/Logging/LogManager.cpp | 19 ++++++++++++++----- Source/Core/DolphinWX/LogWindow.cpp | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Source/Core/Common/Logging/LogManager.cpp b/Source/Core/Common/Logging/LogManager.cpp index 01ada39c9a..7ce347cbda 100644 --- a/Source/Core/Common/Logging/LogManager.cpp +++ b/Source/Core/Common/Logging/LogManager.cpp @@ -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,15 +87,23 @@ 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); - container->AddListener(m_fileLog); - container->AddListener(m_consoleLog); + bool enable; + logs->Get(container->GetShortName(), &enable, false); + container->SetEnable(enable); + if (enable) + { + container->AddListener(m_fileLog); + container->AddListener(m_consoleLog); #ifdef _MSC_VER - if (IsDebuggerPresent()) - container->AddListener(m_debuggerLog); + if (IsDebuggerPresent()) + container->AddListener(m_debuggerLog); #endif + } } } diff --git a/Source/Core/DolphinWX/LogWindow.cpp b/Source/Core/DolphinWX/LogWindow.cpp index a28d455b1e..e3ee0b5139 100644 --- a/Source/Core/DolphinWX/LogWindow.cpp +++ b/Source/Core/DolphinWX/LogWindow.cpp @@ -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);