summaryrefslogtreecommitdiffstats
path: root/src/sdk
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-01-26 15:58:42 +0200
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-02-04 12:00:05 +0200
commitcf48632f89383c9f96346ef8d0ac794f611766a0 (patch)
tree920d58db465e6f2b2d4f920244c9537312df3191 /src/sdk
parentca6dac1b663a7cefcb576692384d69ac0b85b0a5 (diff)
Restructure logging utilities
Create a singleton-pattern class as an encapsulation unit for holding and altering the state of debug printing attributes. Move related code from various places under a single umbrella header file for logging utilities, with some minor stylistic changes & cleanup. This acts as a preparatory change for providing non-blocking headless CLI runs when there is no TTY attached - that will be fixed in a follow-up change. Change-Id: Ib7f72cf75362c3ea6713058e92eda997d6df55c3 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/sdk')
-rw-r--r--src/sdk/commandlineinterface.cpp6
-rw-r--r--src/sdk/main.cpp9
-rw-r--r--src/sdk/sdkapp.h5
3 files changed, 11 insertions, 9 deletions
diff --git a/src/sdk/commandlineinterface.cpp b/src/sdk/commandlineinterface.cpp
index 7bb76d2af..69aa36c43 100644
--- a/src/sdk/commandlineinterface.cpp
+++ b/src/sdk/commandlineinterface.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -34,7 +34,7 @@
#include <globals.h>
#include <productkeycheck.h>
#include <errors.h>
-#include <printoutput.h>
+#include <loggingutils.h>
#include <QDir>
@@ -101,7 +101,7 @@ int CommandLineInterface::checkUpdates()
qCWarning(QInstaller::lcInstallerInstallLog) << "There are currently no updates available.";
return EXIT_SUCCESS;
}
- QInstaller::printComponentInfo(components);
+ QInstaller::LoggingHandler::instance().printComponentInfo(components);
return EXIT_SUCCESS;
}
diff --git a/src/sdk/main.cpp b/src/sdk/main.cpp
index 076458173..a2eb22189 100644
--- a/src/sdk/main.cpp
+++ b/src/sdk/main.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -36,6 +36,7 @@
#include <selfrestarter.h>
#include <remoteserver.h>
#include <utils.h>
+#include <loggingutils.h>
#include <QCommandLineParser>
#include <QDateTime>
@@ -212,14 +213,14 @@ int main(int argc, char *argv[])
foreach (QString value, optionNames) {
if (value == CommandLineOptions::scVerboseShort
|| value == CommandLineOptions::scVerboseLong) {
- QInstaller::setVerbose(true);
+ QInstaller::LoggingHandler::instance().setVerbose(true);
}
}
foreach (const QString &option, CommandLineOptions::scCommandLineInterfaceOptions) {
bool setVerbose = parser.positionalArguments().contains(option);
if (setVerbose) {
- QInstaller::setVerbose(setVerbose);
+ QInstaller::LoggingHandler::instance().setVerbose(setVerbose);
break;
}
}
@@ -267,7 +268,7 @@ int main(int argc, char *argv[])
|| parser.positionalArguments().contains(CommandLineOptions::scCreateOfflineLong)) {
return CommandLineInterface(argc, argv).createOfflineInstaller();
}
- if (QInstaller::isVerbose()) {
+ if (QInstaller::LoggingHandler::instance().isVerbose()) {
std::cout << VERSION << std::endl << BUILDDATE << std::endl << SHA << std::endl;
} else {
#ifdef Q_OS_WIN
diff --git a/src/sdk/sdkapp.h b/src/sdk/sdkapp.h
index 79c112642..ad40e0a42 100644
--- a/src/sdk/sdkapp.h
+++ b/src/sdk/sdkapp.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -46,6 +46,7 @@
#include <runoncechecker.h>
#include <globals.h>
#include <errors.h>
+#include <loggingutils.h>
#include <QApplication>
#include <QDir>
@@ -164,7 +165,7 @@ public:
"ifw.package.* = true\n");
}
- if (QInstaller::verboseLevel() == QInstaller::VerbosityLevel::Detailed) {
+ if (QInstaller::LoggingHandler::instance().verboseLevel() == QInstaller::LoggingHandler::Detailed) {
loggingRules += QLatin1String("\nifw.developer.build = true\n"
"ifw.package.* = true\n");
}