summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Logging/LogManager.cpp
diff options
context:
space:
mode:
authorshuffle2 <godisgovernment@gmail.com>2017-06-27 11:40:26 -0700
committerGitHub <noreply@github.com>2017-06-27 11:40:26 -0700
commit2579a7c03d68ea04ae02b2b3f122a05a53bee50a (patch)
treeb8a5d03eba3aa2f45b9e091e33c03ea6229b2d03 /Source/Core/Common/Logging/LogManager.cpp
parentce4d514542a0106e193c199ac5dbabfa2c849b8e (diff)
parentdd8dcdf880d81a599f478bb868a8e8a85d28e7fd (diff)
Merge pull request #5607 from leoetlino/logging-fix
Logging fixes
Diffstat (limited to 'Source/Core/Common/Logging/LogManager.cpp')
-rw-r--r--Source/Core/Common/Logging/LogManager.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/Source/Core/Common/Logging/LogManager.cpp b/Source/Core/Common/Logging/LogManager.cpp
index 2c09bc5051..2aef9318e7 100644
--- a/Source/Core/Common/Logging/LogManager.cpp
+++ b/Source/Core/Common/Logging/LogManager.cpp
@@ -100,18 +100,33 @@ LogManager::LogManager()
IniFile::Section* options = ini.GetOrCreateSection("Options");
bool write_file;
bool write_console;
+ bool write_window;
options->Get("WriteToFile", &write_file, false);
options->Get("WriteToConsole", &write_console, true);
+ options->Get("WriteToWindow", &write_window, true);
+
+ // Set up log listeners
+ int verbosity;
+ options->Get("Verbosity", &verbosity, 0);
+
+ // Ensure the verbosity level is valid
+ if (verbosity < 1)
+ verbosity = 1;
+ if (verbosity > MAX_LOGLEVEL)
+ verbosity = MAX_LOGLEVEL;
for (LogContainer* container : m_Log)
{
bool enable;
logs->Get(container->GetShortName(), &enable, false);
container->SetEnable(enable);
+ container->SetLevel(static_cast<LogTypes::LOG_LEVELS>(verbosity));
if (enable && write_file)
container->AddListener(LogListener::FILE_LISTENER);
if (enable && write_console)
container->AddListener(LogListener::CONSOLE_LISTENER);
+ if (enable && write_window)
+ container->AddListener(LogListener::LOG_WINDOW_LISTENER);
}
m_path_cutoff_point = DeterminePathCutOffPoint();
@@ -149,7 +164,8 @@ void LogManager::LogWithFullPath(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE
LogTypes::LOG_LEVEL_TO_CHAR[(int)level], log->GetShortName().c_str(), temp);
for (auto listener_id : *log)
- m_listeners[listener_id]->Log(level, msg.c_str());
+ if (m_listeners[listener_id])
+ m_listeners[listener_id]->Log(level, msg.c_str());
}
void LogManager::Init()