Merge lp:~mardy/online-accounts-api/debug-1638166 into lp:online-accounts-api

Proposed by Alberto Mardegan
Status: Merged
Approved by: Alberto Mardegan
Approved revision: 36
Merged at revision: 36
Proposed branch: lp:~mardy/online-accounts-api/debug-1638166
Merge into: lp:online-accounts-api
Diff against target: 99 lines (+19/-5)
5 files modified
src/lib/OnlineAccounts/CMakeLists.txt (+4/-0)
src/lib/OnlineAccounts/authentication_reply.cpp (+4/-3)
src/lib/OnlineAccounts/global.h (+5/-0)
src/lib/OnlineAccounts/manager.cpp (+4/-1)
src/lib/OnlineAccounts/request_access_reply.cpp (+2/-1)
To merge this branch: bzr merge lp:~mardy/online-accounts-api/debug-1638166
Reviewer Review Type Date Requested Status
Alexandre Abreu (community) Approve
Review via email: mp+309742@code.launchpad.net

Commit message

Disable debug output by default

Use QT logging by category functionality, so that logging can be turned on by either an environment variable or via a config file.

Description of the change

Disable debug output by default

Use QT logging by category functionality, so that logging can be turned on by either an environment variable or via a config file.

To post a comment you must log in.
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/lib/OnlineAccounts/CMakeLists.txt'
2--- src/lib/OnlineAccounts/CMakeLists.txt 2015-09-03 13:28:30 +0000
3+++ src/lib/OnlineAccounts/CMakeLists.txt 2016-11-01 11:05:36 +0000
4@@ -8,6 +8,10 @@
5 set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
6 set(CMAKE_CXX_VISIBILITY_PRESET hidden)
7
8+add_definitions(
9+ -DBUILDING_ONLINE_ACCOUNTS
10+)
11+
12 add_library(${CLIENT_LIB} SHARED
13 account.cpp
14 account_info.cpp
15
16=== modified file 'src/lib/OnlineAccounts/authentication_reply.cpp'
17--- src/lib/OnlineAccounts/authentication_reply.cpp 2016-01-13 14:23:12 +0000
18+++ src/lib/OnlineAccounts/authentication_reply.cpp 2016-11-01 11:05:36 +0000
19@@ -50,7 +50,8 @@
20 return QVariant::fromValue(arrayList);
21 } else {
22 /* We don't know how to handle other types */
23- qWarning() << "unhandled type" << argument.currentSignature();
24+ qCWarning(DBG_ONLINE_ACCOUNTS) << "unhandled type" <<
25+ argument.currentSignature();
26 return argument.asVariant();
27 }
28 } else {
29@@ -133,7 +134,7 @@
30 } else {
31 qFatal("Unknown invoked method %d", invokedMethod);
32 }
33- qDebug() << "reply data:" << m_replyData;
34+ qCDebug(DBG_ONLINE_ACCOUNTS) << "reply data:" << m_replyData;
35 }
36
37 AuthenticationReply::AuthenticationReply(const PendingCall &call):
38@@ -264,7 +265,7 @@
39 case ONLINE_ACCOUNTS_AUTH_SASL_STATE_FINISHED: return Finished;
40 case ONLINE_ACCOUNTS_AUTH_SASL_STATE_CONTINUE: return Continue;
41 default:
42- qWarning() << "Unknown SASL state" << state;
43+ qCWarning(DBG_ONLINE_ACCOUNTS) << "Unknown SASL state" << state;
44 return Finished;
45 }
46 }
47
48=== modified file 'src/lib/OnlineAccounts/global.h'
49--- src/lib/OnlineAccounts/global.h 2016-01-13 14:23:12 +0000
50+++ src/lib/OnlineAccounts/global.h 2016-11-01 11:05:36 +0000
51@@ -29,6 +29,11 @@
52 # define ONLINE_ACCOUNTS_EXPORT Q_DECL_IMPORT
53 #endif
54
55+#if defined(BUILDING_ONLINE_ACCOUNTS)
56+#include <QLoggingCategory>
57+Q_DECLARE_LOGGING_CATEGORY(DBG_ONLINE_ACCOUNTS)
58+#endif
59+
60 namespace OnlineAccounts {
61
62 typedef uint AccountId;
63
64=== modified file 'src/lib/OnlineAccounts/manager.cpp'
65--- src/lib/OnlineAccounts/manager.cpp 2016-07-22 05:08:06 +0000
66+++ src/lib/OnlineAccounts/manager.cpp 2016-11-01 11:05:36 +0000
67@@ -31,6 +31,8 @@
68
69 using namespace OnlineAccounts;
70
71+Q_LOGGING_CATEGORY(DBG_ONLINE_ACCOUNTS, "OnlineAccounts", QtWarningMsg)
72+
73 ManagerPrivate::ManagerPrivate(Manager *q, const QString &applicationId,
74 const QDBusConnection& bus):
75 QObject(),
76@@ -125,7 +127,8 @@
77
78 QDBusPendingReply<QList<AccountInfo> > reply = *m_getAccountsCall;
79 if (Q_UNLIKELY(reply.isError())) {
80- qWarning() << "GetAccounts call failed:" << reply.error();
81+ qCWarning(DBG_ONLINE_ACCOUNTS) << "GetAccounts call failed:" <<
82+ reply.error();
83 /* No special handling of the error: the Manager will simply not have
84 * any account */
85 } else {
86
87=== modified file 'src/lib/OnlineAccounts/request_access_reply.cpp'
88--- src/lib/OnlineAccounts/request_access_reply.cpp 2015-03-04 10:01:32 +0000
89+++ src/lib/OnlineAccounts/request_access_reply.cpp 2016-11-01 11:05:36 +0000
90@@ -57,7 +57,8 @@
91
92 if (Q_UNLIKELY(pCall->dbusCall().isError())) {
93 /* Treat all errors as permission denied. */
94- qWarning() << "Error:" << pCall->dbusCall().error().message();
95+ qCWarning(DBG_ONLINE_ACCOUNTS) << "Error:" <<
96+ pCall->dbusCall().error().message();
97 m_error = Error(Error::PermissionDenied,
98 pCall->dbusCall().error().message());
99 return;

Subscribers

People subscribed via source and target branches