Logging: Move verbosity setting code to LogManager

No clue why it was in DolphinWX.
This commit is contained in:
Léo Lam
2017-06-13 14:30:53 +02:00
parent 10beb2aea1
commit 100c433261
2 changed files with 11 additions and 12 deletions

View File

@ -103,11 +103,22 @@ LogManager::LogManager()
options->Get("WriteToFile", &write_file, false);
options->Get("WriteToConsole", &write_console, 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)