aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Dedekind <nick.dedekind@canonical.com>2016-03-29 12:56:59 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2016-03-29 12:56:59 +0000
commitf2b1959914a709cec058e1319b6f3c3797b05709 (patch)
tree1261751ab2fa293e5db8f03a4689bc20f8d20b77
parent2e795a28d40c3f869283716277c087b280a0d2ae (diff)
parent4ad605553fa905edb3a78578fa01dba6c2819176 (diff)
downloadqmenumodel-f2b1959914a709cec058e1319b6f3c3797b05709.tar.gz
qmenumodel-f2b1959914a709cec058e1319b6f3c3797b05709.tar.bz2
qmenumodel-f2b1959914a709cec058e1319b6f3c3797b05709.zip
Use Qt logging categories Fixes: #1562992
Approved by: Daniel d'Andrada, PS Jenkins bot
-rw-r--r--libqmenumodel/src/logging.h23
-rw-r--r--libqmenumodel/src/unitymenumodel.cpp7
2 files changed, 28 insertions, 2 deletions
diff --git a/libqmenumodel/src/logging.h b/libqmenumodel/src/logging.h
new file mode 100644
index 0000000..bd7e708
--- /dev/null
+++ b/libqmenumodel/src/logging.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2016 Canonical, Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License version 3, as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef QMENUMODEL_LOGGING_H
+#define QMENUMODEL_LOGGING_H
+
+#include <QLoggingCategory>
+Q_DECLARE_LOGGING_CATEGORY(unitymenumodel)
+
+#endif // QMENUMODEL_LOGGING_H
diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp
index 63d5e5b..70412a4 100644
--- a/libqmenumodel/src/unitymenumodel.cpp
+++ b/libqmenumodel/src/unitymenumodel.cpp
@@ -22,6 +22,7 @@
#include "unitymenumodelevents.h"
#include "unitymenuaction.h"
#include "unitymenuactionevents.h"
+#include "logging.h"
#include <QIcon>
#include <QQmlComponent>
@@ -33,6 +34,8 @@ extern "C" {
#include "gtk/gtksimpleactionobserver.h"
}
+Q_LOGGING_CATEGORY(unitymenumodel, "qmenumodel.unitymenumodel", QtCriticalMsg)
+
G_DEFINE_QUARK (UNITY_MENU_MODEL, unity_menu_model)
G_DEFINE_QUARK (UNITY_SUBMENU_MODEL, unity_submenu_model)
G_DEFINE_QUARK (UNITY_MENU_ITEM_EXTENDED_ATTRIBUTES, unity_menu_item_extended_attributes)
@@ -654,7 +657,7 @@ bool UnityMenuModel::loadExtendedAttributes(int position, const QVariantMap &sch
GVariant *value = gtk_menu_tracker_item_get_attribute_value (item, name.toUtf8(), NULL);
if (value == NULL) {
- qWarning("loadExtendedAttributes: menu item does not contain '%s'", it.key().toUtf8().constData());
+ qCWarning(unitymenumodel, "loadExtendedAttributes: menu item does not contain '%s'", it.key().toUtf8().constData());
continue;
}
@@ -662,7 +665,7 @@ bool UnityMenuModel::loadExtendedAttributes(int position, const QVariantMap &sch
if (qvalue.isValid())
extendedAttrs->insert(qtify_name (name.toUtf8()), qvalue);
else
- qWarning("loadExtendedAttributes: key '%s' is of type '%s' (expected '%s')",
+ qCWarning(unitymenumodel, "loadExtendedAttributes: key '%s' is of type '%s' (expected '%s')",
name.toUtf8().constData(), g_variant_get_type_string(value), type.constData());
g_variant_unref (value);