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);
#endif
DestinationPtr fileDestination(DestinationFactory::MakeFileDestination(
destLog, EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
DestinationPtr debugDestination(DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(debugDestination);
logger.addDestination(fileDestination);
DestinationPtrU fileDestination(DestinationFactory::MakeFileDestination(
destLog, LogRotationOption::EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
DestinationPtrU debugDestination(DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(std::move(debugDestination));
logger.addDestination(std::move(fileDestination));
QTranslator translator;
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
{
QLOG_WARN() << "another instance of YACReaderLibrary is running";
QsLogging::Logger::destroyInstance();
#ifdef Q_OS_WIN
logger.shutDownLoggerThread();
#endif
return 0;
}
QLOG_INFO() << "YACReaderLibrary starting";
@ -267,8 +269,8 @@ int main(int argc, char **argv)
localServer->close();
delete localServer;
delete mw;
QsLogging::Logger::destroyInstance();
#ifdef Q_OS_WIN
logger.shutDownLoggerThread();
#endif
return ret;
}

View File

@ -149,11 +149,11 @@ int main(int argc, char **argv)
}
}
DestinationPtr fileDestination(DestinationFactory::MakeFileDestination(
destLog, EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
DestinationPtr debugDestination(DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(debugDestination);
logger.addDestination(fileDestination);
DestinationPtrU fileDestination(DestinationFactory::MakeFileDestination(
destLog, LogRotationOption::EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
DestinationPtrU debugDestination(DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(std::move(debugDestination));
logger.addDestination(std::move(fileDestination));
QTranslator translator;
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
{
QLOG_WARN() << "another instance of YACReaderLibrary is running";
QsLogging::Logger::destroyInstance();
#ifdef Q_OS_WIN
logger.shutDownLoggerThread();
#endif
return 0;
}
QLOG_INFO() << "YACReaderLibrary starting";
@ -208,9 +210,9 @@ int main(int argc, char **argv)
delete s;
localServer->close();
delete localServer;
QsLogging::Logger::destroyInstance();
#ifdef Q_OS_WIN
logger.shutDownLoggerThread();
#endif
return ret;
} else if (command == "create-library") {
parser.clearPositionalArguments();