logic: Cleaned up LogManager and setupLogging call
This commit is contained in:
+2
-5
@@ -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);
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
class LogManager
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<LogManager> createInstance();
|
||||
static std::shared_ptr<LogManager> getInstance();
|
||||
static void destroyInstance();
|
||||
|
||||
|
||||
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user