logic: Cleaned up LogManager and setupLogging call

This commit is contained in:
Eberhard Graether
2017-02-13 20:25:24 +01:00
parent 259b112080
commit 637da119aa
4 changed files with 3 additions and 19 deletions
+2 -5
View File
@@ -29,7 +29,6 @@
void setupLogging()
{
LogManager::createInstance();
LogManager* logManager = LogManager::getInstance().get();
std::shared_ptr<ConsoleLogger> consoleLogger = std::make_shared<ConsoleLogger>();
@@ -102,8 +101,6 @@ int main(int argc, char *argv[])
{
QApplication::setApplicationName("Coati");
setupLogging();
if (QSysInfo::windowsVersion() != QSysInfo::WV_None)
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
@@ -129,7 +126,7 @@ int main(int argc, char *argv[])
setupApp(argc, argv);
// setupLogging(); // why would you setup logging that late? the logger is possibly already in use before this line!!
setupLogging();
Application::createInstance(version, nullptr, nullptr);
ScopedFunctor f([](){
@@ -181,7 +178,7 @@ int main(int argc, char *argv[])
setupApp(argc, argv);
// setupLogging(); // why would you setup logging that late? the logger is possibly already in use before this line!!
setupLogging();
qtApp.setAttribute(Qt::AA_UseHighDpiPixmaps);
-12
View File
@@ -7,20 +7,8 @@
#include "utility/messaging/type/MessageStatus.h"
#include "utility/Version.h"
std::shared_ptr<LogManager> LogManager::createInstance()
{
if (s_instance.use_count() == 0)
{
s_instance = std::shared_ptr<LogManager>(new LogManager());
}
return s_instance;
}
// what is this method for? why would you want to risk returning s_instance without checking whether it is initialized???
std::shared_ptr<LogManager> LogManager::getInstance()
{
// return s_instance; // original implementation
if (s_instance.use_count() == 0)
{
s_instance = std::shared_ptr<LogManager>(new LogManager());
-1
View File
@@ -9,7 +9,6 @@
class LogManager
{
public:
static std::shared_ptr<LogManager> createInstance();
static std::shared_ptr<LogManager> getInstance();
static void destroyInstance();
+1 -1
View File
@@ -20,7 +20,7 @@ TestSuiteFixture::~TestSuiteFixture()
bool TestSuiteFixture::setUpWorld()
{
LogManager* logManager = LogManager::createInstance().get();
LogManager* logManager = LogManager::getInstance().get();
logManager->setLoggingEnabled(true);
logManager->addLogger(std::make_shared<PlainFileLogger>("data/log/test_log.txt"));