From cd9d37aac402b0edd0f12b66fd7f2fdd5fe6dff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 2 Feb 2015 02:14:14 +0100 Subject: SCRATCH nuke the overcomplicated logger, use a simple one. --- logic/net/ByteArrayDownload.cpp | 8 ++++---- logic/net/CacheDownload.cpp | 16 ++++++++-------- logic/net/HttpMetaCache.cpp | 6 +++--- logic/net/MD5EtagDownload.cpp | 12 ++++++------ logic/net/NetJob.cpp | 8 ++++---- logic/net/PasteUpload.cpp | 6 +++--- 6 files changed, 28 insertions(+), 28 deletions(-) (limited to 'logic/net') diff --git a/logic/net/ByteArrayDownload.cpp b/logic/net/ByteArrayDownload.cpp index e56ac9b6..9f71f911 100644 --- a/logic/net/ByteArrayDownload.cpp +++ b/logic/net/ByteArrayDownload.cpp @@ -15,7 +15,7 @@ #include "ByteArrayDownload.h" #include "logic/Env.h" -#include "logger/QsLog.h" +#include ByteArrayDownload::ByteArrayDownload(QUrl url) : NetAction() { @@ -25,7 +25,7 @@ ByteArrayDownload::ByteArrayDownload(QUrl url) : NetAction() void ByteArrayDownload::start() { - QLOG_INFO() << "Downloading " << m_url.toString(); + qDebug() << "Downloading " << m_url.toString(); QNetworkRequest request(m_url); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); auto worker = ENV.qnam(); @@ -50,7 +50,7 @@ void ByteArrayDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal void ByteArrayDownload::downloadError(QNetworkReply::NetworkError error) { // error happened during download. - QLOG_ERROR() << "Error getting URL:" << m_url.toString().toLocal8Bit() + qCritical() << "Error getting URL:" << m_url.toString().toLocal8Bit() << "Network error: " << error; m_status = Job_Failed; m_errorString = m_reply->errorString(); @@ -74,7 +74,7 @@ void ByteArrayDownload::downloadFinished() if (!redirectURL.isEmpty()) { m_url = QUrl(redirect.toString()); - QLOG_INFO() << "Following redirect to " << m_url.toString(); + qDebug() << "Following redirect to " << m_url.toString(); start(); return; } diff --git a/logic/net/CacheDownload.cpp b/logic/net/CacheDownload.cpp index 1bf59c60..6ddfc55f 100644 --- a/logic/net/CacheDownload.cpp +++ b/logic/net/CacheDownload.cpp @@ -19,7 +19,7 @@ #include #include #include -#include "logger/QsLog.h" +#include #include "logic/Env.h" CacheDownload::CacheDownload(QUrl url, MetaEntryPtr entry) @@ -46,19 +46,19 @@ void CacheDownload::start() // if there already is a file and md5 checking is in effect and it can be opened if (!ensureFilePathExists(m_target_path)) { - QLOG_ERROR() << "Could not create folder for " + m_target_path; + qCritical() << "Could not create folder for " + m_target_path; m_status = Job_Failed; emit failed(m_index_within_job); return; } if (!m_output_file->open(QIODevice::WriteOnly)) { - QLOG_ERROR() << "Could not open " + m_target_path + " for writing"; + qCritical() << "Could not open " + m_target_path + " for writing"; m_status = Job_Failed; emit failed(m_index_within_job); return; } - QLOG_INFO() << "Downloading " << m_url.toString(); + qDebug() << "Downloading " << m_url.toString(); QNetworkRequest request(m_url); // check file consistency first. @@ -96,7 +96,7 @@ void CacheDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) void CacheDownload::downloadError(QNetworkReply::NetworkError error) { // error happened during download. - QLOG_ERROR() << "Failed " << m_url.toString() << " with reason " << error; + qCritical() << "Failed " << m_url.toString() << " with reason " << error; m_status = Job_Failed; } void CacheDownload::downloadFinished() @@ -117,7 +117,7 @@ void CacheDownload::downloadFinished() if (!redirectURL.isEmpty()) { m_url = QUrl(redirect.toString()); - QLOG_INFO() << "Following redirect to " << m_url.toString(); + qDebug() << "Following redirect to " << m_url.toString(); start(); return; } @@ -142,7 +142,7 @@ void CacheDownload::downloadFinished() } else { - QLOG_ERROR() << "Failed to commit changes to " << m_target_path; + qCritical() << "Failed to commit changes to " << m_target_path; m_output_file->cancelWriting(); m_reply.reset(); m_status = Job_Failed; @@ -181,7 +181,7 @@ void CacheDownload::downloadReadyRead() md5sum.addData(ba); if (m_output_file->write(ba) != ba.size()) { - QLOG_ERROR() << "Failed writing into " + m_target_path; + qCritical() << "Failed writing into " + m_target_path; m_status = Job_Failed; m_reply->abort(); emit failed(m_index_within_job); diff --git a/logic/net/HttpMetaCache.cpp b/logic/net/HttpMetaCache.cpp index eb931b8a..7e52f16c 100644 --- a/logic/net/HttpMetaCache.cpp +++ b/logic/net/HttpMetaCache.cpp @@ -24,7 +24,7 @@ #include #include -#include "logger/QsLog.h" +#include #include #include @@ -122,13 +122,13 @@ bool HttpMetaCache::updateEntry(MetaEntryPtr stale_entry) { if (!m_entries.contains(stale_entry->base)) { - QLOG_ERROR() << "Cannot add entry with unknown base: " + qCritical() << "Cannot add entry with unknown base: " << stale_entry->base.toLocal8Bit(); return false; } if (stale_entry->stale) { - QLOG_ERROR() << "Cannot add stale entry: " << stale_entry->getFullPath().toLocal8Bit(); + qCritical() << "Cannot add stale entry: " << stale_entry->getFullPath().toLocal8Bit(); return false; } m_entries[stale_entry->base].entry_list[stale_entry->path] = stale_entry; diff --git a/logic/net/MD5EtagDownload.cpp b/logic/net/MD5EtagDownload.cpp index 79038f36..6e1d0cfc 100644 --- a/logic/net/MD5EtagDownload.cpp +++ b/logic/net/MD5EtagDownload.cpp @@ -17,7 +17,7 @@ #include "MD5EtagDownload.h" #include #include -#include "logger/QsLog.h" +#include MD5EtagDownload::MD5EtagDownload(QUrl url, QString target_path) : NetAction() { @@ -45,7 +45,7 @@ void MD5EtagDownload::start() // skip if they match if(m_local_md5 == m_expected_md5) { - QLOG_INFO() << "Skipping " << m_url.toString() << ": md5 match."; + qDebug() << "Skipping " << m_url.toString() << ": md5 match."; emit succeeded(m_index_within_job); return; } @@ -63,14 +63,14 @@ void MD5EtagDownload::start() QNetworkRequest request(m_url); - QLOG_INFO() << "Downloading " << m_url.toString() << " local MD5: " << m_local_md5; + qDebug() << "Downloading " << m_url.toString() << " local MD5: " << m_local_md5; if(!m_local_md5.isEmpty()) { request.setRawHeader(QString("If-None-Match").toLatin1(), m_local_md5.toLatin1()); } if(!m_expected_md5.isEmpty()) - QLOG_INFO() << "Expecting " << m_expected_md5; + qDebug() << "Expecting " << m_expected_md5; request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); @@ -104,7 +104,7 @@ void MD5EtagDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) void MD5EtagDownload::downloadError(QNetworkReply::NetworkError error) { - QLOG_ERROR() << "Error" << error << ":" << m_reply->errorString() << "while downloading" + qCritical() << "Error" << error << ":" << m_reply->errorString() << "while downloading" << m_reply->url(); m_status = Job_Failed; } @@ -120,7 +120,7 @@ void MD5EtagDownload::downloadFinished() // FIXME: compare with the real written data md5sum // this is just an ETag - QLOG_INFO() << "Finished " << m_url.toString() << " got " << m_reply->rawHeader("ETag").constData(); + qDebug() << "Finished " << m_url.toString() << " got " << m_reply->rawHeader("ETag").constData(); m_reply.reset(); emit succeeded(m_index_within_job); diff --git a/logic/net/NetJob.cpp b/logic/net/NetJob.cpp index c5f93ae1..e10afbc8 100644 --- a/logic/net/NetJob.cpp +++ b/logic/net/NetJob.cpp @@ -19,7 +19,7 @@ #include "ByteArrayDownload.h" #include "CacheDownload.h" -#include "logger/QsLog.h" +#include void NetJob::partSucceeded(int index) { @@ -66,7 +66,7 @@ void NetJob::partProgress(int index, qint64 bytesReceived, qint64 bytesTotal) void NetJob::start() { - QLOG_INFO() << m_job_name.toLocal8Bit() << " started."; + qDebug() << m_job_name.toLocal8Bit() << " started."; m_running = true; for (int i = 0; i < downloads.size(); i++) { @@ -85,12 +85,12 @@ void NetJob::startMoreParts() { if(!m_failed.size()) { - QLOG_INFO() << m_job_name.toLocal8Bit() << "succeeded."; + qDebug() << m_job_name.toLocal8Bit() << "succeeded."; emit succeeded(); } else { - QLOG_ERROR() << m_job_name.toLocal8Bit() << "failed."; + qCritical() << m_job_name.toLocal8Bit() << "failed."; emit failed(); } } diff --git a/logic/net/PasteUpload.cpp b/logic/net/PasteUpload.cpp index f68595c9..6bed0887 100644 --- a/logic/net/PasteUpload.cpp +++ b/logic/net/PasteUpload.cpp @@ -1,6 +1,6 @@ #include "PasteUpload.h" #include "logic/Env.h" -#include "logger/QsLog.h" +#include #include #include @@ -40,7 +40,7 @@ void PasteUpload::executeTask() void PasteUpload::downloadError(QNetworkReply::NetworkError error) { // error happened during download. - QLOG_ERROR() << "Network error: " << error; + qCritical() << "Network error: " << error; emitFailed(m_reply->errorString()); } @@ -80,7 +80,7 @@ bool PasteUpload::parseResult(QJsonDocument doc) auto status = object.value("status").toString("error"); if (status == "error") { - QLOG_ERROR() << "paste.ee reported error:" << QString(object.value("error").toString()); + qCritical() << "paste.ee reported error:" << QString(object.value("error").toString()); return false; } m_pasteLink = object.value("paste").toObject().value("link").toString(); -- cgit v1.2.3