From 2554ccb7ba4ef3103411e38b0c2d5d218217cccd Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 23 Apr 2015 12:00:17 +0200 Subject: Enable logging categories as an installer option. Now by default all categories are disabled. They get enabled only in verbose mode. Verbose mode enables all categories by default. Categories can be filtered using logging-rules option. Change-Id: I9324826a6e2d7a746e3d7369747fcd31a42b84b6 Reviewed-by: Karsten Heimrich Reviewed-by: Kai Koehne --- src/libs/installer/componentchecker.cpp | 3 +-- src/libs/installer/componentchecker.h | 4 ---- src/libs/installer/globals.cpp | 18 +++++++++++++++++- src/libs/installer/globals.h | 4 ++++ src/libs/installer/packagemanagercore_p.cpp | 3 ++- 5 files changed, 24 insertions(+), 8 deletions(-) (limited to 'src/libs') diff --git a/src/libs/installer/componentchecker.cpp b/src/libs/installer/componentchecker.cpp index 2b806a5b4..33e78b008 100644 --- a/src/libs/installer/componentchecker.cpp +++ b/src/libs/installer/componentchecker.cpp @@ -37,11 +37,10 @@ #include "component.h" #include "constants.h" #include "packagemanagercore.h" +#include "globals.h" namespace QInstaller { -Q_LOGGING_CATEGORY(componentChecker, "ifw.componentChecker") - QStringList ComponentChecker::checkComponent(Component *component) { QStringList checkResult; diff --git a/src/libs/installer/componentchecker.h b/src/libs/installer/componentchecker.h index 252a04f6c..84c4e3d14 100644 --- a/src/libs/installer/componentchecker.h +++ b/src/libs/installer/componentchecker.h @@ -37,12 +37,8 @@ #include "installer_global.h" #include -#include - namespace QInstaller { -Q_DECLARE_LOGGING_CATEGORY(componentChecker) - class Component; class INSTALLER_EXPORT ComponentChecker diff --git a/src/libs/installer/globals.cpp b/src/libs/installer/globals.cpp index 05e19304e..43e5b4365 100644 --- a/src/libs/installer/globals.cpp +++ b/src/libs/installer/globals.cpp @@ -33,8 +33,24 @@ **************************************************************************/ #include "globals.h" +const char IFW_COMPONENT_CHECKER[] = "ifw.componentChecker"; + +namespace QInstaller +{ + +Q_LOGGING_CATEGORY(lcComponentChecker, IFW_COMPONENT_CHECKER) + Q_GLOBAL_STATIC_WITH_ARGS(QRegExp, staticCommaRegExp, (QLatin1String("\\b(,|, )\\b"))); -QRegExp QInstaller::commaRegExp() +QRegExp commaRegExp() { return *staticCommaRegExp(); } + +QStringList loggingCategories() +{ + static QStringList categories = QStringList() << QLatin1String(IFW_COMPONENT_CHECKER); + return categories; +} + +} // namespace QInstaller + diff --git a/src/libs/installer/globals.h b/src/libs/installer/globals.h index 4df5878b9..3d6461690 100644 --- a/src/libs/installer/globals.h +++ b/src/libs/installer/globals.h @@ -37,10 +37,14 @@ #include "installer_global.h" #include +#include namespace QInstaller { +Q_DECLARE_LOGGING_CATEGORY(lcComponentChecker) + QRegExp INSTALLER_EXPORT commaRegExp(); +QStringList INSTALLER_EXPORT loggingCategories(); } // QInstaller diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 9fef0575a..f318a47bb 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -53,6 +53,7 @@ #include "installercalculator.h" #include "uninstallercalculator.h" #include "componentchecker.h" +#include "globals.h" #include "kdselfrestarter.h" #include "kdupdaterfiledownloaderfactory.h" @@ -395,7 +396,7 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash &c foreach (QInstaller::Component *component, components) { const QStringList warnings = ComponentChecker::checkComponent(component); foreach (const QString &warning, warnings) - qCWarning(componentChecker) << warning; + qCWarning(lcComponentChecker) << warning; } } catch (const Error &error) { clearAllComponentLists(); -- cgit v1.2.3