summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/httpget.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-11-03 11:08:18 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-11-04 23:32:52 +0100
commit4d2ce949b3b41f8bf0af446fa20205ddd229e579 (patch)
tree01fa19471d9831b296bea5d7049f765e38b30bbb /rbutil/rbutilqt/base/httpget.cpp
parent335ec75d60bba82f23fc47b20f9390e0cba9c9c5 (diff)
downloadrockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.tar.gz
rockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.tar.bz2
rockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.zip
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
Diffstat (limited to 'rbutil/rbutilqt/base/httpget.cpp')
-rw-r--r--rbutil/rbutilqt/base/httpget.cpp20
1 files changed, 10 insertions, 10 deletions
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 <QNetworkRequest>
#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);