Fix QsLog setup in Library and LibraryServer

The calls changed, so we need to adapt them.
This commit is contained in:
Felix Kauselmann 2020-07-24 19:14:50 +02:00
parent 1568a5f253
commit 1af613663c
2 changed files with 22 additions and 18 deletions

View File

@ -147,11 +147,11 @@ int main(int argc, char **argv)
logger.setLoggingLevel(QsLogging::ErrorLevel); logger.setLoggingLevel(QsLogging::ErrorLevel);
#endif #endif
DestinationPtr fileDestination(DestinationFactory::MakeFileDestination( DestinationPtrU fileDestination(DestinationFactory::MakeFileDestination(
destLog, EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2))); destLog, LogRotationOption::EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
DestinationPtr debugDestination(DestinationFactory::MakeDebugOutputDestination()); DestinationPtrU debugDestination(DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(debugDestination); logger.addDestination(std::move(debugDestination));
logger.addDestination(fileDestination); logger.addDestination(std::move(fileDestination));
QTranslator translator; QTranslator translator;
QString sufix = QLocale::system().name(); QString sufix = QLocale::system().name();
@ -232,7 +232,9 @@ int main(int argc, char **argv)
if (YACReaderLocalServer::isRunning()) //s<>lo se permite una instancia de YACReaderLibrary if (YACReaderLocalServer::isRunning()) //s<>lo se permite una instancia de YACReaderLibrary
{ {
QLOG_WARN() << "another instance of YACReaderLibrary is running"; QLOG_WARN() << "another instance of YACReaderLibrary is running";
QsLogging::Logger::destroyInstance(); #ifdef Q_OS_WIN
logger.shutDownLoggerThread();
#endif
return 0; return 0;
} }
QLOG_INFO() << "YACReaderLibrary starting"; QLOG_INFO() << "YACReaderLibrary starting";
@ -267,8 +269,8 @@ int main(int argc, char **argv)
localServer->close(); localServer->close();
delete localServer; delete localServer;
delete mw; delete mw;
#ifdef Q_OS_WIN
QsLogging::Logger::destroyInstance(); logger.shutDownLoggerThread();
#endif
return ret; return ret;
} }

View File

@ -149,11 +149,11 @@ int main(int argc, char **argv)
} }
} }
DestinationPtr fileDestination(DestinationFactory::MakeFileDestination( DestinationPtrU fileDestination(DestinationFactory::MakeFileDestination(
destLog, EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2))); destLog, LogRotationOption::EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
DestinationPtr debugDestination(DestinationFactory::MakeDebugOutputDestination()); DestinationPtrU debugDestination(DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(debugDestination); logger.addDestination(std::move(debugDestination));
logger.addDestination(fileDestination); logger.addDestination(std::move(fileDestination));
QTranslator translator; QTranslator translator;
QString sufix = QLocale::system().name(); QString sufix = QLocale::system().name();
@ -188,7 +188,9 @@ int main(int argc, char **argv)
if (YACReaderLocalServer::isRunning()) //s�lo se permite una instancia de YACReaderLibrary if (YACReaderLocalServer::isRunning()) //s�lo se permite una instancia de YACReaderLibrary
{ {
QLOG_WARN() << "another instance of YACReaderLibrary is running"; QLOG_WARN() << "another instance of YACReaderLibrary is running";
QsLogging::Logger::destroyInstance(); #ifdef Q_OS_WIN
logger.shutDownLoggerThread();
#endif
return 0; return 0;
} }
QLOG_INFO() << "YACReaderLibrary starting"; QLOG_INFO() << "YACReaderLibrary starting";
@ -208,9 +210,9 @@ int main(int argc, char **argv)
delete s; delete s;
localServer->close(); localServer->close();
delete localServer; delete localServer;
#ifdef Q_OS_WIN
QsLogging::Logger::destroyInstance(); logger.shutDownLoggerThread();
#endif
return ret; return ret;
} else if (command == "create-library") { } else if (command == "create-library") {
parser.clearPositionalArguments(); parser.clearPositionalArguments();