From 4d2ce949b3b41f8bf0af446fa20205ddd229e579 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 3 Nov 2013 11:08:18 +0100 Subject: Use cutelogger for Rockbox Utility internal trace. Change tracing from qDebug() to use cutelogger, which is available under the LGPL2.1. This allows to automatically add filename and line number to the log, and also provides multiple log levels. Change-Id: I5dbdaf902ba54ea99f07ae10a07467c52fdac910 --- rbutil/rbutilqt/base/httpget.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'rbutil/rbutilqt/base/httpget.cpp') diff --git a/rbutil/rbutilqt/base/httpget.cpp b/rbutil/rbutilqt/base/httpget.cpp index e6b9eb4d3c..4b08faf33b 100644 --- a/rbutil/rbutilqt/base/httpget.cpp +++ b/rbutil/rbutilqt/base/httpget.cpp @@ -23,6 +23,7 @@ #include #include "httpget.h" +#include "Logger.h" QString HttpGet::m_globalUserAgent; //< globally set user agent for requests QDir HttpGet::m_globalCache; //< global cach path value for new objects @@ -71,14 +72,14 @@ void HttpGet::setCache(bool c) QString path = m_cachedir.absolutePath(); if(!c || m_cachedir.absolutePath().isEmpty()) { - qDebug() << "[HttpGet] disabling download cache"; + LOG_INFO() << "disabling download cache"; } else { // append the cache path to make it unique in case the path points to // the system temporary path. In that case using it directly might // cause problems. Extra path also used in configure dialog. path += "/rbutil-cache"; - qDebug() << "[HttpGet] setting cache folder to" << path; + LOG_INFO() << "setting cache folder to" << path; m_cache = new QNetworkDiskCache(this); m_cache->setCacheDirectory(path); } @@ -97,7 +98,7 @@ QByteArray HttpGet::readAll() void HttpGet::setProxy(const QUrl &proxy) { - qDebug() << "[HttpGet] Proxy set to" << proxy; + LOG_INFO() << "Proxy set to" << proxy; m_proxy.setType(QNetworkProxy::HttpProxy); m_proxy.setHostName(proxy.host()); m_proxy.setPort(proxy.port()); @@ -130,10 +131,10 @@ void HttpGet::requestFinished(QNetworkReply* reply) { m_lastStatusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - qDebug() << "[HttpGet] Request finished, status code:" << m_lastStatusCode; + LOG_INFO() << "Request finished, status code:" << m_lastStatusCode; m_lastServerTimestamp = reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().toLocalTime(); - qDebug() << "[HttpGet] Data from cache:" + LOG_INFO() << "Data from cache:" << reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(); m_lastRequestCached = reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(); @@ -150,7 +151,7 @@ void HttpGet::requestFinished(QNetworkReply* reply) #else url.setQuery(org.query()); #endif - qDebug() << "[HttpGet] Redirected to" << url; + LOG_INFO() << "Redirected to" << url; startRequest(url); return; } @@ -179,7 +180,7 @@ void HttpGet::downloadProgress(qint64 received, qint64 total) void HttpGet::startRequest(QUrl url) { - qDebug() << "[HttpGet] Request started"; + LOG_INFO() << "Request started"; QNetworkRequest req(url); if(!m_globalUserAgent.isEmpty()) req.setRawHeader("User-Agent", m_globalUserAgent.toLatin1()); @@ -194,15 +195,14 @@ void HttpGet::startRequest(QUrl url) void HttpGet::networkError(QNetworkReply::NetworkError error) { - qDebug() << "[HttpGet] NetworkError occured:" - << error << m_reply->errorString(); + LOG_ERROR() << "NetworkError occured:" << error << m_reply->errorString(); m_lastErrorString = m_reply->errorString(); } bool HttpGet::getFile(const QUrl &url) { - qDebug() << "[HttpGet] Get URI" << url.toString(); + LOG_INFO() << "Get URI" << url.toString(); m_data.clear(); startRequest(url); -- cgit v1.2.3