From fd7d9b5dbb08120015779e70065d7e6eb34de398 Mon Sep 17 00:00:00 2001 From: Matthew Territo Date: Thu, 16 Feb 2017 12:18:36 -0700 Subject: [PATCH] Update LogManager singleton initialization --- apps/Launcher/mainwindow.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/Launcher/mainwindow.cpp b/apps/Launcher/mainwindow.cpp index d9e31b2753..5d4489d47a 100644 --- a/apps/Launcher/mainwindow.cpp +++ b/apps/Launcher/mainwindow.cpp @@ -179,26 +179,26 @@ void MainWindow::configureLogging() { const std::string KeyLogs = openspace::ConfigurationManager::KeyLauncher + '.' + openspace::ConfigurationManager::PartLogs; + std::string logLevel = "None"; + bool immediateFlush = false; + if (_configuration->hasKeyAndValue(KeyLogLevel)) { - std::string logLevel; _configuration->getValue(KeyLogLevel, logLevel); - - bool immediateFlush = false; _configuration->getValue(KeyLogImmediateFlush, immediateFlush); - - ghoul::logging::LogLevel level = ghoul::logging::levelFromString(logLevel); - LogMgr.deinitialize(); - using ImmediateFlush = ghoul::logging::LogManager::ImmediateFlush; - LogMgr.initialize( - level, - immediateFlush ? ImmediateFlush::Yes : ImmediateFlush::No - ); - LogMgr.addLog(std::make_unique()); - // TODO: This can crash the system in cases where the logfile can't be created ---abock - LogMgr.addLog(std::make_unique< ghoul::logging::HTMLLog >("LauncherLog.html", ghoul::logging::HTMLLog::Append::No)); - LogMgr.addLog(std::make_unique< QLog >()); } + ghoul::logging::LogLevel level = ghoul::logging::levelFromString(logLevel); + using ImmediateFlush = ghoul::logging::LogManager::ImmediateFlush; + + ghoul::logging::LogManager::initialize( + level, + immediateFlush ? ImmediateFlush::Yes : ImmediateFlush::No + ); + LogMgr.addLog(std::make_unique()); + // TODO: This can crash the system in cases where the logfile can't be created ---abock + LogMgr.addLog(std::make_unique< ghoul::logging::HTMLLog >("LauncherLog.html", ghoul::logging::HTMLLog::Append::No)); + LogMgr.addLog(std::make_unique< QLog >()); + if (_configuration->hasKeyAndValue(KeyLogs)) { ghoul::Dictionary logs; _configuration->getValue(KeyLogs, logs);