diff options
author | Robert Griebl <robert.griebl@pelagicore.com> | 2018-03-28 15:57:04 +0200 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2018-03-29 08:20:06 +0000 |
commit | 25c4a185c583aeb1777561af89c55b5f48213cdc (patch) | |
tree | 234cfee9a87aa092dbc5b16b4828cd5c62299ad7 | |
parent | aa72378d1806b95944b68174b23f4a53f6ffb92e (diff) |
Suppress debug output from config file parsing
As with the sudo output, these debugs will be replayed later using the
DeploymentWarnings category.
Change-Id: Iaf7544945006a76e584865f467f951437ce077f1
Reviewed-by: Bernd Weimer <bernd.weimer@pelagicore.com>
-rw-r--r-- | src/main-lib/configuration.cpp | 16 | ||||
-rw-r--r-- | src/main-lib/configuration.h | 2 | ||||
-rw-r--r-- | src/main-lib/defaultconfiguration.cpp | 4 | ||||
-rw-r--r-- | src/main-lib/defaultconfiguration.h | 2 | ||||
-rw-r--r-- | src/tools/appman/appman.cpp | 2 |
5 files changed, 13 insertions, 13 deletions
diff --git a/src/main-lib/configuration.cpp b/src/main-lib/configuration.cpp index 763dd473..a76a382e 100644 --- a/src/main-lib/configuration.cpp +++ b/src/main-lib/configuration.cpp @@ -231,7 +231,7 @@ void Configuration::showParserMessage(const QString &message, MessageType type) // ^^^^ copied from QCommandLineParser ... why is this not public API? -void Configuration::parse() +void Configuration::parse(QStringList *deploymentWarnings) { if (!m_clp.parse(QCoreApplication::arguments())) { showParserMessage(m_clp.errorText() + qL1C('\n'), ErrorMessage); @@ -312,14 +312,15 @@ void Configuration::parse() qCDebug(LogSystem) << "Config parsing: cache loaded after" << (timer.nsecsElapsed() / 1000) << "usec"; #endif } catch (const Exception &e) { - qCDebug(LogSystem) << "Failed to read config cache:" << e.what(); + if (deploymentWarnings) + *deploymentWarnings << qL1S("Failed to read config cache:") + qL1S(e.what()); } } } // reads a single config file and calculates its hash - defined as lambda to be usable // both via QtConcurrent and via std:for_each - auto readConfigFile = [&useCache](ConfigFile &cf) { + auto readConfigFile = [&useCache, &deploymentWarnings](ConfigFile &cf) { QFile file(cf.filePath); if (!file.open(QIODevice::ReadOnly)) throw Exception("Failed to open config file '%1' for reading.\n").arg(file.fileName()); @@ -331,7 +332,8 @@ void Configuration::parse() QByteArray checksum = QCryptographicHash::hash(cf.content, QCryptographicHash::Sha1); if (useCache && (checksum != cf.checksum)) { - qCDebug(LogSystem) << "Failed to read config cache: cached config file checksums do not match current set"; + if (deploymentWarnings) + *deploymentWarnings << qL1S("Failed to read config cache: cached config file checksums do not match current set"); useCache = false; } cf.checksum = checksum; @@ -353,8 +355,6 @@ void Configuration::parse() #endif if (useCache) { - qCDebug(LogSystem) << "Using existing config cache:" << cacheFilePath; - m_config = cache; } else if (!configFilePaths.isEmpty()) { auto parseConfigFile = [](ConfigFile &cf) { @@ -421,7 +421,8 @@ void Configuration::parse() if (ds.status() != QDataStream::Ok) throw Exception("error writing config cache content"); } catch (const Exception &e) { - qCWarning(LogSystem) << "Failed to write config cache:" << e.what(); + if (deploymentWarnings) + *deploymentWarnings << qL1S("Failed to write config cache: ") + qL1S(e.what()); } } #if defined(AM_TIME_CONFIG_PARSING) @@ -457,7 +458,6 @@ void Configuration::parse() // QVariant ... the workaround is to save invalid variants to the cache and fix them up // afterwards: fixNullValuesForQml(m_config); - } QT_END_NAMESPACE_AM diff --git a/src/main-lib/configuration.h b/src/main-lib/configuration.h index 36662471..b448371d 100644 --- a/src/main-lib/configuration.h +++ b/src/main-lib/configuration.h @@ -53,7 +53,7 @@ class Configuration { public: virtual ~Configuration(); - virtual void parse(); + virtual void parse(QStringList *deploymentWarnings = nullptr); QVariant buildConfig() const; protected: diff --git a/src/main-lib/defaultconfiguration.cpp b/src/main-lib/defaultconfiguration.cpp index 4a88266d..e878cc5e 100644 --- a/src/main-lib/defaultconfiguration.cpp +++ b/src/main-lib/defaultconfiguration.cpp @@ -124,9 +124,9 @@ DefaultConfiguration::~DefaultConfiguration() } -void DefaultConfiguration::parse() +void DefaultConfiguration::parse(QStringList *deploymentWarnings) { - Configuration::parse(); + Configuration::parse(deploymentWarnings); if (m_onlyOnePositionalArgument && (m_clp.positionalArguments().size() > 1)) { showParserMessage(qL1S("Only one main qml file can be specified.\n"), ErrorMessage); diff --git a/src/main-lib/defaultconfiguration.h b/src/main-lib/defaultconfiguration.h index a146d3ac..9d17df9a 100644 --- a/src/main-lib/defaultconfiguration.h +++ b/src/main-lib/defaultconfiguration.h @@ -57,7 +57,7 @@ public: bool onlyOnePositionalArgument = true); ~DefaultConfiguration(); - void parse(); + void parse(QStringList *deploymentWarnings = nullptr) override; QString mainQmlFile() const; QString database() const; diff --git a/src/tools/appman/appman.cpp b/src/tools/appman/appman.cpp index 4b4da3f5..1a1eb28e 100644 --- a/src/tools/appman/appman.cpp +++ b/src/tools/appman/appman.cpp @@ -99,7 +99,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) #endif DefaultConfiguration cfg(additionalDescription, onlyOnePositionalArgument); - cfg.parse(); + cfg.parse(&deploymentWarnings); StartupTimer::instance()->checkpoint("after command line parse"); #if defined(AM_TESTRUNNER) |