diff --git a/ext/ghoul b/ext/ghoul index 68ec5fef09..62d6b98d7d 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 68ec5fef095ddc79f1d75057ea3a917816352556 +Subproject commit 62d6b98d7d33535d31f7029f0118c074ada5810d diff --git a/include/openspace/engine/logfactory.h b/include/openspace/engine/logfactory.h index 8b67a2f1dd..ab615b4236 100644 --- a/include/openspace/engine/logfactory.h +++ b/include/openspace/engine/logfactory.h @@ -26,6 +26,7 @@ #define __LOGFACTORY_H__ #include +#include namespace ghoul { namespace logging { @@ -37,7 +38,7 @@ namespace openspace { class LogFactory { public: - static ghoul::logging::Log* createLog(const ghoul::Dictionary& dictionary); + static std::unique_ptr createLog(const ghoul::Dictionary& dictionary); }; } // namespace openspace diff --git a/src/engine/logfactory.cpp b/src/engine/logfactory.cpp index 4f493a3363..6e668993de 100644 --- a/src/engine/logfactory.cpp +++ b/src/engine/logfactory.cpp @@ -45,7 +45,7 @@ namespace { namespace openspace { -ghoul::logging::Log* LogFactory::createLog(const ghoul::Dictionary& dictionary) { +std::unique_ptr LogFactory::createLog(const ghoul::Dictionary& dictionary) { std::string type; bool typeSuccess = dictionary.getValue(keyType, type); if (!typeSuccess) { @@ -74,12 +74,14 @@ ghoul::logging::Log* LogFactory::createLog(const ghoul::Dictionary& dictionary) dictionary.getValue(keyLogLevelStamping, logLevelStamp); if (type == valueHtmlLog) { - return new ghoul::logging::HTMLLog( - filename, append, timeStamp, dateStamp, categoryStamp, logLevelStamp); + return std::make_unique( + filename, append, timeStamp, dateStamp, categoryStamp, logLevelStamp + ); } else if (type == valueTextLog) { - return new ghoul::logging::TextLog( - filename, append, timeStamp, dateStamp, categoryStamp, logLevelStamp); + return std::make_unique( + filename, append, timeStamp, dateStamp, categoryStamp, logLevelStamp + ); } else { LERROR("Log with type '" << type << "' did not name a valid log"); diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 68b3fd3081..890257e21f 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -189,7 +189,7 @@ bool OpenSpaceEngine::create( // configuration file, we will deinitialize this LogManager and reinitialize it later // with the correct LogLevel LogManager::initialize(LogManager::LogLevel::Debug, true); - LogMgr.addLog(new ConsoleLog); + LogMgr.addLog(std::make_unique()); LDEBUG("Initialize FileSystem"); @@ -614,7 +614,7 @@ void OpenSpaceEngine::configureLogging() { LogManager::LogLevel level = LogManager::levelFromString(logLevel); LogManager::deinitialize(); LogManager::initialize(level, immediateFlush); - LogMgr.addLog(new ConsoleLog); + LogMgr.addLog(std::make_unique()); } if (configurationManager()->hasKeyAndValue(ConfigurationManager::KeyLogs)) { @@ -625,10 +625,10 @@ void OpenSpaceEngine::configureLogging() { ghoul::Dictionary logInfo; logs.getValue(std::to_string(i), logInfo); - Log* log = LogFactory::createLog(logInfo); + std::unique_ptr log = LogFactory::createLog(logInfo); if (log) - LogMgr.addLog(log); + LogMgr.addLog(std::move(log)); } } } diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 7e8cc38ec2..bb27f80ec1 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -290,8 +290,9 @@ bool RenderEngine::initializeGL() { _abuffer->initialize(); LINFO("Initializing Log"); - _log = new ScreenLog(); - ghoul::logging::LogManager::ref().addLog(_log); + std::unique_ptr log = std::make_unique(); + _log = log.get(); + ghoul::logging::LogManager::ref().addLog(std::move(log)); LINFO("Initializing Visualizer"); _visualizer = new ABufferVisualizer();