diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-05-01 01:54:53 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-01 01:54:53 +0900 |
commit | 096a05d59654244f7c928dc5f2537a760070a577 (patch) | |
tree | 1ee17f9016b0f333c08cf5d0eb0c8a8ab86a8573 /jobs/basejob.cpp | |
parent | 9a13bbfd8a800712d0a2fcc4887c8d4115d06d4e (diff) | |
parent | 3fa1ee3c6b04d0793ccca3f903797625f7a08d03 (diff) | |
download | libquotient-096a05d59654244f7c928dc5f2537a760070a577.tar.gz libquotient-096a05d59654244f7c928dc5f2537a760070a577.zip |
Merge pull request #61 from elvisangelaccio/qloggingcategory
Port to categorized logging
Diffstat (limited to 'jobs/basejob.cpp')
-rw-r--r-- | jobs/basejob.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp index 226290ff..3e2ecd54 100644 --- a/jobs/basejob.cpp +++ b/jobs/basejob.cpp @@ -17,6 +17,7 @@ */ #include "basejob.h" +#include "util.h" #include <array> @@ -86,13 +87,13 @@ BaseJob::BaseJob(ConnectionData* connection, HttpVerb verb, QString name, connect (&d->timer, &QTimer::timeout, this, &BaseJob::timeout); d->retryTimer.setSingleShot(true); connect (&d->retryTimer, &QTimer::timeout, this, &BaseJob::start); - qDebug() << this << "created"; + qCDebug(JOBS) << this << "created"; } BaseJob::~BaseJob() { stop(); - qDebug() << this << "destroyed"; + qCDebug(JOBS) << this << "destroyed"; } ConnectionData* BaseJob::connection() const @@ -174,7 +175,7 @@ void BaseJob::gotReply() BaseJob::Status BaseJob::checkReply(QNetworkReply* reply) const { if (reply->error() != QNetworkReply::NoError) - qDebug() << this << "returned" << reply->error(); + qCDebug(JOBS) << this << "returned" << reply->error(); switch( reply->error() ) { case QNetworkReply::NoError: @@ -217,11 +218,11 @@ void BaseJob::stop() d->timer.stop(); if (!d->reply) { - qWarning() << this << "stopped with empty network reply"; + qCWarning(JOBS) << this << "stopped with empty network reply"; } else if (d->reply->isRunning()) { - qWarning() << this << "stopped without ready network reply"; + qCWarning(JOBS) << this << "stopped without ready network reply"; d->reply->disconnect(this); // Ignore whatever comes from the reply d->reply->abort(); } @@ -235,7 +236,7 @@ void BaseJob::finishJob() { const auto retryInterval = getNextRetryInterval(); ++d->retriesTaken; - qWarning() << this << "will take retry" << d->retriesTaken + qCWarning(JOBS) << this << "will take retry" << d->retriesTaken << "in" << retryInterval/1000 << "s"; d->retryTimer.start(retryInterval); emit retryScheduled(d->retriesTaken, retryInterval); @@ -301,7 +302,7 @@ void BaseJob::setStatus(Status s) d->status = s; if (!s.good()) { - qWarning() << this << "status" << s.code << ":" << s.message; + qCWarning(JOBS) << this << "status" << s.code << ":" << s.message; } } @@ -324,7 +325,7 @@ void BaseJob::timeout() void BaseJob::sslErrors(const QList<QSslError>& errors) { foreach (const QSslError &error, errors) { - qWarning() << "SSL ERROR" << error.errorString(); + qCWarning(JOBS) << "SSL ERROR" << error.errorString(); } d->reply->ignoreSslErrors(); // TODO: insecure! should prompt user first } |