diff options
author | Jocelyn Turcotte <jturcotte@woboq.com> | 2017-05-09 15:24:11 +0300 |
---|---|---|
committer | Jocelyn Turcotte <jturcotte@woboq.com> | 2017-05-11 18:22:59 +0300 |
commit | 4ad190a558c64aac846dc828438acdec5fe9c6ed (patch) | |
tree | 92879909a4036fd51f7ece53654a0474298409c6 /src/libsync/cookiejar.cpp | |
parent | 3a193655b3bdb9634c753e9e7b73a56469249655 (diff) |
Use Qt logging categories for logging
This gives more insight about the logs and allow setting fine-tuned
logging rules. The categories are set to only output Info by default
so this allows us to provide more concise logging while keeping the
ability to extract more information for a specific category when
developping or debugging customer issues.
Issue #5647
Diffstat (limited to 'src/libsync/cookiejar.cpp')
-rw-r--r-- | src/libsync/cookiejar.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libsync/cookiejar.cpp b/src/libsync/cookiejar.cpp index b3e205628..836b5d1ba 100644 --- a/src/libsync/cookiejar.cpp +++ b/src/libsync/cookiejar.cpp @@ -16,14 +16,16 @@ #include "configfile.h" -#include <QDebug> #include <QFile> #include <QDateTime> +#include <QLoggingCategory> #include <QNetworkCookie> #include <QDataStream> namespace OCC { +Q_LOGGING_CATEGORY(lcCookieJar, "sync.cookiejar", QtInfoMsg) + namespace { const unsigned int JAR_VERSION = 23; } @@ -55,7 +57,7 @@ QDataStream &operator>>(QDataStream &stream, QList<QNetworkCookie> &list) stream >> value; QList<QNetworkCookie> newCookies = QNetworkCookie::parseCookies(value); if (newCookies.count() == 0 && value.length() != 0) { - qWarning() << "CookieJar: Unable to parse saved cookie:" << value; + qCWarning(lcCookieJar) << "CookieJar: Unable to parse saved cookie:" << value; } for (int j = 0; j < newCookies.count(); ++j) list.append(newCookies.at(j)); @@ -87,7 +89,7 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie>& cookieList, const QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl &url) const { QList<QNetworkCookie> cookies = QNetworkCookieJar::cookiesForUrl(url); -// qDebug() << url << "requests:" << cookies; + qCDebug(lcCookieJar) << url << "requests:" << cookies; return cookies; } @@ -100,7 +102,7 @@ void CookieJar::save(const QString &fileName) { QFile file; file.setFileName(fileName); - qDebug() << fileName; + qCDebug(lcCookieJar) << fileName; file.open(QIODevice::WriteOnly); QDataStream stream(&file); stream << removeExpired(allCookies()); |