Merge lp:~nick-dedekind/qmenumodel/logging-categories into lp:qmenumodel

Proposed by Nick Dedekind
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 120
Merged at revision: 120
Proposed branch: lp:~nick-dedekind/qmenumodel/logging-categories
Merge into: lp:qmenumodel
Diff against target: 66 lines (+28/-2)
2 files modified
libqmenumodel/src/logging.h (+23/-0)
libqmenumodel/src/unitymenumodel.cpp (+5/-2)
To merge this branch: bzr merge lp:~nick-dedekind/qmenumodel/logging-categories
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Daniel d'Andrada Approve
Marco Trevisan (Treviño) Needs Fixing
Review via email: mp+286635@code.launchpad.net

Commit message

Use Qt logging categories

Description of the change

use categories.
change loadExtendedAttributes to log hit failure to debug.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

/tmp/buildd/qmenumodel-0.2.9+15.04.20150430bzr119pkg0wily4/libqmenumodel/src/unitymenumodel.cpp:25:21: fatal error: logging.h: No such file or directory

review: Needs Fixing
120. By Nick Dedekind

added missing file

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> /tmp/buildd/qmenumodel-0.2.9+15.04.20150430bzr119pkg0wily4/libqmenumodel/src/u
> nitymenumodel.cpp:25:21: fatal error: logging.h: No such file or directory

Added

121. By Nick Dedekind

only log critical

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Works great!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'libqmenumodel/src/logging.h'
2--- libqmenumodel/src/logging.h 1970-01-01 00:00:00 +0000
3+++ libqmenumodel/src/logging.h 2016-02-23 14:36:05 +0000
4@@ -0,0 +1,23 @@
5+/*
6+ * Copyright (C) 2016 Canonical, Ltd.
7+ *
8+ * This program is free software: you can redistribute it and/or modify it under
9+ * the terms of the GNU Lesser General Public License version 3, as published by
10+ * the Free Software Foundation.
11+ *
12+ * This program is distributed in the hope that it will be useful, but WITHOUT
13+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
14+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+ * Lesser General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU Lesser General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+
21+#ifndef QMENUMODEL_LOGGING_H
22+#define QMENUMODEL_LOGGING_H
23+
24+#include <QLoggingCategory>
25+Q_DECLARE_LOGGING_CATEGORY(unitymenumodel)
26+
27+#endif // QMENUMODEL_LOGGING_H
28
29=== modified file 'libqmenumodel/src/unitymenumodel.cpp'
30--- libqmenumodel/src/unitymenumodel.cpp 2014-07-29 13:39:50 +0000
31+++ libqmenumodel/src/unitymenumodel.cpp 2016-02-23 14:36:05 +0000
32@@ -22,6 +22,7 @@
33 #include "unitymenumodelevents.h"
34 #include "unitymenuaction.h"
35 #include "unitymenuactionevents.h"
36+#include "logging.h"
37
38 #include <QIcon>
39 #include <QQmlComponent>
40@@ -33,6 +34,8 @@
41 #include "gtk/gtksimpleactionobserver.h"
42 }
43
44+Q_LOGGING_CATEGORY(unitymenumodel, "qmenumodel.unitymenumodel", QtCriticalMsg)
45+
46 G_DEFINE_QUARK (UNITY_MENU_MODEL, unity_menu_model)
47 G_DEFINE_QUARK (UNITY_SUBMENU_MODEL, unity_submenu_model)
48 G_DEFINE_QUARK (UNITY_MENU_ITEM_EXTENDED_ATTRIBUTES, unity_menu_item_extended_attributes)
49@@ -654,7 +657,7 @@
50
51 GVariant *value = gtk_menu_tracker_item_get_attribute_value (item, name.toUtf8(), NULL);
52 if (value == NULL) {
53- qWarning("loadExtendedAttributes: menu item does not contain '%s'", it.key().toUtf8().constData());
54+ qCWarning(unitymenumodel, "loadExtendedAttributes: menu item does not contain '%s'", it.key().toUtf8().constData());
55 continue;
56 }
57
58@@ -662,7 +665,7 @@
59 if (qvalue.isValid())
60 extendedAttrs->insert(qtify_name (name.toUtf8()), qvalue);
61 else
62- qWarning("loadExtendedAttributes: key '%s' is of type '%s' (expected '%s')",
63+ qCWarning(unitymenumodel, "loadExtendedAttributes: key '%s' is of type '%s' (expected '%s')",
64 name.toUtf8().constData(), g_variant_get_type_string(value), type.constData());
65
66 g_variant_unref (value);

Subscribers

People subscribed via source and target branches