summaryrefslogtreecommitdiffstats
path: root/src/libs/installer
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-10-18 17:28:49 +0300
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-10-22 11:13:00 +0300
commit4066fbebcabbdf591c2fc525343f8f78486457d2 (patch)
treef8772769de741b3b35f62a920a8cea24496556b5 /src/libs/installer
parentf8bebde7599a12becffac6c6dbfa58f0d584bc01 (diff)
Print essential component information with std::cout
Do not use our own message handler for printing XML-formatted component information (from 'list', 'search', 'check-updates') that is expected to be included in output regardless of the current verbosity level or logging rules. Higher verbosity can still add more information to be included in output. Also: - Modify auto-tests to pass and check the output correctly. - Remove now orphaned 'ifw.package.info' logging category. - Rename 'LoggingHandler::printComponentInformation()' to 'printUpdateInformation()' to better match the intended purpose. Task-number: QTIFW-2349 Change-Id: Id1a868f8f824c606825cd6168974a7e3845383e6 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/libs/installer')
-rw-r--r--src/libs/installer/globals.cpp7
-rw-r--r--src/libs/installer/globals.h1
-rw-r--r--src/libs/installer/loggingutils.cpp15
-rw-r--r--src/libs/installer/loggingutils.h2
4 files changed, 7 insertions, 18 deletions
diff --git a/src/libs/installer/globals.cpp b/src/libs/installer/globals.cpp
index 0da4bc3b6..adf1d2f6e 100644
--- a/src/libs/installer/globals.cpp
+++ b/src/libs/installer/globals.cpp
@@ -33,7 +33,6 @@
const char IFW_SERVER[] = "ifw.server";
const char IFW_INSTALLER_INSTALLLOG[] = "ifw.installer.installlog";
const char IFW_DEVELOPER_BUILD[] = "ifw.developer.build";
-const char IFW_PACKAGE_INFO[] = "ifw.package.info";
// Internal-only, hidden in --help text
const char IFW_PROGRESS_INDICATOR[] = "ifw.progress.indicator";
@@ -61,16 +60,10 @@ namespace QInstaller
\internal
*/
-/*!
- \fn QInstaller::lcPackageInfo()
- \internal
-*/
-
Q_LOGGING_CATEGORY(lcServer, IFW_SERVER)
Q_LOGGING_CATEGORY(lcInstallerInstallLog, IFW_INSTALLER_INSTALLLOG)
Q_LOGGING_CATEGORY(lcProgressIndicator, IFW_PROGRESS_INDICATOR)
Q_LOGGING_CATEGORY(lcDeveloperBuild, IFW_DEVELOPER_BUILD)
-Q_LOGGING_CATEGORY(lcPackageInfo, IFW_PACKAGE_INFO)
/*!
Returns available logging categories.
diff --git a/src/libs/installer/globals.h b/src/libs/installer/globals.h
index 5053f6d9f..b22331e2c 100644
--- a/src/libs/installer/globals.h
+++ b/src/libs/installer/globals.h
@@ -40,7 +40,6 @@ INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcInstallerInstallLog)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcProgressIndicator)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcDeveloperBuild)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageInfo)
QStringList INSTALLER_EXPORT loggingCategories();
diff --git a/src/libs/installer/loggingutils.cpp b/src/libs/installer/loggingutils.cpp
index 45f7aab1b..a2b561c53 100644
--- a/src/libs/installer/loggingutils.cpp
+++ b/src/libs/installer/loggingutils.cpp
@@ -145,10 +145,7 @@ void LoggingHandler::messageHandler(QtMsgType type, const QMessageLogContext &co
static Uptime uptime;
- QString ba;
- if (context.category != lcPackageInfo().categoryName()) {
- ba = QLatin1Char('[') + QString::number(uptime.elapsed()) + QStringLiteral("] ");
- }
+ QString ba = QLatin1Char('[') + QString::number(uptime.elapsed()) + QStringLiteral("] ");
ba += trimAndPrepend(type, msg);
if (type != QtDebugMsg && context.file) {
@@ -251,9 +248,9 @@ bool LoggingHandler::outputRedirected() const
}
/*!
- Prints basic information about \a components.
+ Prints update information from \a components.
*/
-void LoggingHandler::printComponentInfo(const QList<Component *> components) const
+void LoggingHandler::printUpdateInformation(const QList<Component *> components) const
{
QDomDocument doc;
QDomElement root = doc.createElement(QLatin1String("updates"));
@@ -267,7 +264,7 @@ void LoggingHandler::printComponentInfo(const QList<Component *> components) con
update.setAttribute(QLatin1String("id"), component->value(scName));
root.appendChild(update);
}
- qCDebug(lcPackageInfo) << qPrintable(doc.toString(4));
+ std::cout << qPrintable(doc.toString(4));
}
/*!
@@ -297,7 +294,7 @@ void LoggingHandler::printLocalPackageInformation(const QList<KDUpdater::LocalPa
}
root.appendChild(update);
}
- qCDebug(lcPackageInfo) << qPrintable(doc.toString(4));
+ std::cout << qPrintable(doc.toString(4));
}
/*!
@@ -341,7 +338,7 @@ void LoggingHandler::printPackageInformation(const PackagesList &matchedPackages
}
root.appendChild(update);
}
- qCDebug(lcPackageInfo) << qPrintable(doc.toString(4));
+ std::cout << qPrintable(doc.toString(4));
}
/*!
diff --git a/src/libs/installer/loggingutils.h b/src/libs/installer/loggingutils.h
index a997a6d60..06f0400f8 100644
--- a/src/libs/installer/loggingutils.h
+++ b/src/libs/installer/loggingutils.h
@@ -57,7 +57,7 @@ public:
VerbosityLevel verboseLevel() const;
bool outputRedirected() const;
- void printComponentInfo(const QList<Component *> components) const;
+ void printUpdateInformation(const QList<Component *> components) const;
void printLocalPackageInformation(const QList<KDUpdater::LocalPackage> &packages) const;
void printPackageInformation(const PackagesList &matchedPackages, const LocalPackagesHash &installedPackages) const;