cleanup warnings and allow setting "unknown" debug categories

This commit is contained in:
Michael Zanetti 2019-11-06 13:38:22 +01:00
parent 25152c5e27
commit ec15e664e1
9 changed files with 8 additions and 16 deletions

View File

@ -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)) {

View File

@ -253,7 +253,6 @@ JsonReply *RulesHandler::GetRuleDetails(const QVariantMap &params)
JsonReply* RulesHandler::AddRule(const QVariantMap &params)
{
Rule rule = unpack<Rule>(params);
qWarning() << "Unpacked rule" << rule;
rule.setId(RuleId::createRuleId());
RuleEngine::RuleError status = NymeaCore::instance()->ruleEngine()->addRule(rule);

View File

@ -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();

View File

@ -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<RuleId> m_executingRules;

View File

@ -389,8 +389,6 @@ StateEvaluators::StateEvaluators(const QList<StateEvaluator> &other): QList<Stat
QVariant StateEvaluators::get(int index) const
{
qWarning() << "getting" << index << "of" << count();
qWarning() << "at" << at(index);
return QVariant::fromValue(at(index));
}

View File

@ -292,6 +292,5 @@ QVariant CalendarItems::get(int index) const
void CalendarItems::put(const QVariant &variant)
{
qWarning() << "Putting!" << variant;
append(variant.value<CalendarItem>());
}

View File

@ -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

View File

@ -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

View File

@ -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();
}