SCRATCH nuke the overcomplicated logger, use a simple one.
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
|
||||
#include "ByteArrayDownload.h"
|
||||
#include "logic/Env.h"
|
||||
#include "logger/QsLog.h"
|
||||
#include <QDebug>
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <QCryptographicHash>
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
#include "logger/QsLog.h"
|
||||
#include <QDebug>
|
||||
#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);
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
#include "logger/QsLog.h"
|
||||
#include <QDebug>
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
@ -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;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "MD5EtagDownload.h"
|
||||
#include <pathutils.h>
|
||||
#include <QCryptographicHash>
|
||||
#include "logger/QsLog.h"
|
||||
#include <QDebug>
|
||||
|
||||
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);
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "ByteArrayDownload.h"
|
||||
#include "CacheDownload.h"
|
||||
|
||||
#include "logger/QsLog.h"
|
||||
#include <QDebug>
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "PasteUpload.h"
|
||||
#include "logic/Env.h"
|
||||
#include "logger/QsLog.h"
|
||||
#include <QDebug>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
@ -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();
|
||||
|
Reference in New Issue
Block a user