diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-09-19 12:56:29 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-09-19 12:57:33 +0900 |
commit | 0b11b06379fe668063ea5658a261f53f1dcf117a (patch) | |
tree | b62c178744c17b87751a89ae0bfa88c35e033860 /jobs | |
parent | d4cb62523585137dee7879f2143ae1b4dd62513d (diff) | |
download | libquotient-0b11b06379fe668063ea5658a261f53f1dcf117a.tar.gz libquotient-0b11b06379fe668063ea5658a261f53f1dcf117a.zip |
BaseJob: improved logging
Your QT_LOGGING_RULES (especially useful with Qt 5.6 and newer) should
work a bit better now:
* "Job" prefix is no more needed because the Qt logging prefix
(libqmatrixclient.jobs) says it already;
* The "created" record didn't follow the logging category if overridden
from the concrete job class (see SyncJob); so instead of "created"
there's now much more useful "sending request" record.
Diffstat (limited to 'jobs')
-rw-r--r-- | jobs/basejob.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp index 8c9ef222..3057ed75 100644 --- a/jobs/basejob.cpp +++ b/jobs/basejob.cpp @@ -24,6 +24,7 @@ #include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkReply> #include <QtCore/QTimer> +#include <QtCore/QStringBuilder> #include <array> @@ -76,7 +77,7 @@ class BaseJob::Private inline QDebug operator<<(QDebug dbg, const BaseJob* j) { - return dbg << "Job" << j->objectName(); + return dbg << j->objectName(); } BaseJob::BaseJob(const ConnectionData* connection, HttpVerb verb, @@ -89,7 +90,6 @@ BaseJob::BaseJob(const ConnectionData* connection, HttpVerb verb, connect (&d->timer, &QTimer::timeout, this, &BaseJob::timeout); d->retryTimer.setSingleShot(true); connect (&d->retryTimer, &QTimer::timeout, this, &BaseJob::start); - qCDebug(d->logCat) << this << "created"; } BaseJob::~BaseJob() @@ -159,6 +159,8 @@ void BaseJob::start() { emit aboutToStart(); d->retryTimer.stop(); // In case we were counting down at the moment + qCDebug(d->logCat) << this << "sending request to" + << d->apiEndpoint % '?' % d->requestQuery.toString(); d->sendRequest(); connect( d->reply.data(), &QNetworkReply::sslErrors, this, &BaseJob::sslErrors ); connect( d->reply.data(), &QNetworkReply::finished, this, &BaseJob::gotReply ); |