diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-01-26 15:58:42 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-02-04 12:00:05 +0200 |
commit | cf48632f89383c9f96346ef8d0ac794f611766a0 (patch) | |
tree | 920d58db465e6f2b2d4f920244c9537312df3191 /tools | |
parent | ca6dac1b663a7cefcb576692384d69ac0b85b0a5 (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 'tools')
-rw-r--r-- | tools/binarycreator/main.cpp | 5 | ||||
-rw-r--r-- | tools/devtool/main.cpp | 5 | ||||
-rw-r--r-- | tools/repogen/repogen.cpp | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/tools/binarycreator/main.cpp b/tools/binarycreator/main.cpp index b5a0ae4f7..c28a2ebb3 100644 --- a/tools/binarycreator/main.cpp +++ b/tools/binarycreator/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. @@ -29,6 +29,7 @@ #include <binarycreator.h> #include <init.h> #include <utils.h> +#include <loggingutils.h> #include <QtCore/QDebug> @@ -152,7 +153,7 @@ int main(int argc, char **argv) parsedArgs.ftype = QInstallerTools::Include; } else if (*it == QLatin1String("-v") || *it == QLatin1String("--verbose")) { - QInstaller::setVerbose(true); + LoggingHandler::instance().setVerbose(true); } else if (*it == QLatin1String("-n") || *it == QLatin1String("--online-only")) { parsedArgs.onlineOnly = true; } else if (*it == QLatin1String("-f") || *it == QLatin1String("--offline-only")) { diff --git a/tools/devtool/main.cpp b/tools/devtool/main.cpp index 208ef148e..52db7d8b3 100644 --- a/tools/devtool/main.cpp +++ b/tools/devtool/main.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 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. @@ -37,6 +37,7 @@ #include <fileutils.h> #include <init.h> #include <utils.h> +#include <loggingutils.h> #include <QCoreApplication> #include <QCommandLineParser> @@ -161,7 +162,7 @@ int main(int argc, char *argv[]) return fail(QString::fromLatin1("\"%1\" is not a devtool command.").arg(command)); QInstaller::init(); - QInstaller::setVerbose(parser.isSet(verbose)); + QInstaller::LoggingHandler::instance().setVerbose(parser.isSet(verbose)); QString bundlePath; QString path = QFileInfo(arguments.first()).absoluteFilePath(); diff --git a/tools/repogen/repogen.cpp b/tools/repogen/repogen.cpp index 10aa0370b..a88867e92 100644 --- a/tools/repogen/repogen.cpp +++ b/tools/repogen/repogen.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. @@ -33,6 +33,7 @@ #include <updater.h> #include <settings.h> #include <utils.h> +#include <loggingutils.h> #include <lib7z_facade.h> #include <QDomDocument> @@ -112,7 +113,7 @@ int main(int argc, char** argv) while (!args.isEmpty() && args.first().startsWith(QLatin1Char('-'))) { if (args.first() == QLatin1String("--verbose") || args.first() == QLatin1String("-v")) { args.removeFirst(); - setVerbose(true); + LoggingHandler::instance().setVerbose(true); } else if (args.first() == QLatin1String("--exclude") || args.first() == QLatin1String("-e")) { args.removeFirst(); if (!filteredPackages.isEmpty()) { |