From ec15e664e17e50a1ab0797839f345d658c34f270 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 6 Nov 2019 13:38:22 +0100 Subject: [PATCH] cleanup warnings and allow setting "unknown" debug categories --- libnymea-core/jsonrpc/jsonvalidator.cpp | 2 -- libnymea-core/jsonrpc/ruleshandler.cpp | 1 - libnymea-core/nymeacore.cpp | 2 +- libnymea-core/nymeacore.h | 2 ++ libnymea-core/ruleengine/stateevaluator.cpp | 2 -- libnymea/time/calendaritem.cpp | 1 - server/main.cpp | 10 +++++----- tests/auto/rules/testrules.cpp | 1 - tests/auto/timemanager/testtimemanager.cpp | 3 --- 9 files changed, 8 insertions(+), 16 deletions(-) diff --git a/libnymea-core/jsonrpc/jsonvalidator.cpp b/libnymea-core/jsonrpc/jsonvalidator.cpp index 6cfe24a3..9846e834 100644 --- a/libnymea-core/jsonrpc/jsonvalidator.cpp +++ b/libnymea-core/jsonrpc/jsonvalidator.cpp @@ -34,9 +34,7 @@ bool JsonValidator::checkRefs(const QVariantMap &map, const QVariantMap &api) QVariantMap enums = api.value("enums").toMap(); QVariantMap flags = api.value("flags").toMap(); QVariantMap types = api.value("types").toMap(); -// qWarning() << "checkrefs enums" << enums.keys(); foreach (const QString &key, map.keys()) { -// qWarning() << "checking prop" << key << types.keys(); if (map.value(key).toString().startsWith("$ref:")) { QString refName = map.value(key).toString().remove("$ref:"); if (!enums.contains(refName) && !flags.contains(refName) && !types.contains(refName)) { diff --git a/libnymea-core/jsonrpc/ruleshandler.cpp b/libnymea-core/jsonrpc/ruleshandler.cpp index 12345a65..2141f198 100644 --- a/libnymea-core/jsonrpc/ruleshandler.cpp +++ b/libnymea-core/jsonrpc/ruleshandler.cpp @@ -253,7 +253,6 @@ JsonReply *RulesHandler::GetRuleDetails(const QVariantMap ¶ms) JsonReply* RulesHandler::AddRule(const QVariantMap ¶ms) { Rule rule = unpack(params); - qWarning() << "Unpacked rule" << rule; rule.setId(RuleId::createRuleId()); RuleEngine::RuleError status = NymeaCore::instance()->ruleEngine()->addRule(rule); diff --git a/libnymea-core/nymeacore.cpp b/libnymea-core/nymeacore.cpp index 7397cd74..44574b64 100644 --- a/libnymea-core/nymeacore.cpp +++ b/libnymea-core/nymeacore.cpp @@ -173,7 +173,7 @@ void NymeaCore::init() { m_cloudManager = new CloudManager(m_configuration, m_networkManager, this); qCDebug(dcApplication()) << "Loading experiences"; - new ExperienceManager(m_deviceManager, m_serverManager->jsonServer(), this); + m_experienceManager = new ExperienceManager(m_deviceManager, m_serverManager->jsonServer(), this); CloudNotifications *cloudNotifications = m_cloudManager->createNotificationsPlugin(); diff --git a/libnymea-core/nymeacore.h b/libnymea-core/nymeacore.h index 06c7c2f0..9a80434e 100644 --- a/libnymea-core/nymeacore.h +++ b/libnymea-core/nymeacore.h @@ -54,6 +54,7 @@ class TagsStorage; class UserManager; class Platform; class System; +class ExperienceManager; class NymeaCore : public QObject { @@ -134,6 +135,7 @@ private: NetworkManager *m_networkManager; UserManager *m_userManager; System *m_system; + ExperienceManager *m_experienceManager; QList m_executingRules; diff --git a/libnymea-core/ruleengine/stateevaluator.cpp b/libnymea-core/ruleengine/stateevaluator.cpp index 677c122d..8cb99110 100644 --- a/libnymea-core/ruleengine/stateevaluator.cpp +++ b/libnymea-core/ruleengine/stateevaluator.cpp @@ -389,8 +389,6 @@ StateEvaluators::StateEvaluators(const QList &other): QList()); } diff --git a/server/main.cpp b/server/main.cpp index ce69a08d..d9f1a39e 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -208,11 +208,11 @@ int main(int argc, char *argv[]) bool isWarning = debugArea.endsWith("Warnings"); debugArea.remove(QRegExp("^No")); debugArea.remove(QRegExp("Warnings$")); - if (loggingFilters.contains(debugArea) || loggingFiltersPlugins.contains(debugArea)) { - loggingRules.append(QString("%1.%2=%3").arg(debugArea).arg(isWarning ? "warning" : "debug").arg(enable ? "true": "false")); - } else { - qCWarning(dcApplication) << QCoreApplication::translate("nymea", "No such debug category:") << debugArea; - } + loggingRules.append(QString("%1.%2=%3").arg(debugArea).arg(isWarning ? "warning" : "debug").arg(enable ? "true": "false")); +// if (loggingFilters.contains(debugArea) || loggingFiltersPlugins.contains(debugArea)) { +// } else { +// qCWarning(dcApplication) << QCoreApplication::translate("nymea", "No such debug category:") << debugArea; +// } } // Finally set the rules for the logging diff --git a/tests/auto/rules/testrules.cpp b/tests/auto/rules/testrules.cpp index 82fb41b8..113664c9 100644 --- a/tests/auto/rules/testrules.cpp +++ b/tests/auto/rules/testrules.cpp @@ -3010,7 +3010,6 @@ void TestRules::testLoopingRules() addRuleParams.insert("eventDescriptors", QVariantList() << offEvent); addRuleParams.insert("actions", QVariantList() << onAction); QVariant response = injectAndWait("Rules.AddRule", addRuleParams); - qWarning() << response; verifyRuleError(response); // Add rule 1 diff --git a/tests/auto/timemanager/testtimemanager.cpp b/tests/auto/timemanager/testtimemanager.cpp index a3585600..e15336f4 100644 --- a/tests/auto/timemanager/testtimemanager.cpp +++ b/tests/auto/timemanager/testtimemanager.cpp @@ -259,8 +259,6 @@ void TestTimeManager::loadSaveTimeDescriptor() .arg(QString(QJsonDocument::fromVariant(timeDescriptorMapLoaded).toJson())) .toUtf8()); -// qWarning() << "+++" << QString(QJsonDocument::fromVariant(timeDescriptorMap).toJson()); -// qWarning() << "---" << QString(QJsonDocument::fromVariant(timeDescriptorMapLoaded).toJson()); // REMOVE rule QVariantMap removeParams; removeParams.insert("ruleId", ruleId); @@ -2087,7 +2085,6 @@ void TestTimeManager::verifyRuleNotExecuted() QCOMPARE(spy.count(), 1); QByteArray actionHistory = reply->readAll(); - qWarning() << "actionHistory" << actionHistory; QVERIFY2(actionHistory.isEmpty(), "Actfdsfadsion is triggered while it should not have been."); reply->deleteLater(); }