diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-10-06 01:13:40 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-10-06 01:13:40 +0200 |
commit | f83119ce7ec3d11a903901b8eff762d2b0a9f635 (patch) | |
tree | 5c30d7b9fff0f9417e7f2cd79d8ad9ea56d7f056 /logic/net/DownloadJob.cpp | |
parent | eba9b3d759dbf6e402e91ab897059f1d274aef90 (diff) | |
download | MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar.gz MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar.lz MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar.xz MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.zip |
Added file logger
Diffstat (limited to 'logic/net/DownloadJob.cpp')
-rw-r--r-- | logic/net/DownloadJob.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/logic/net/DownloadJob.cpp b/logic/net/DownloadJob.cpp index 03a69555..f6275b7a 100644 --- a/logic/net/DownloadJob.cpp +++ b/logic/net/DownloadJob.cpp @@ -5,7 +5,7 @@ #include "ByteArrayDownload.h" #include "CacheDownload.h" -#include <QDebug> +#include <logger/QsLog.h> ByteArrayDownloadPtr DownloadJob::addByteArrayDownload(QUrl url) { @@ -54,18 +54,18 @@ void DownloadJob::partSucceeded(int index) partProgress(index, slot.total_progress, slot.total_progress); num_succeeded++; - qDebug() << m_job_name.toLocal8Bit() << " progress: " << num_succeeded << "/" + QLOG_INFO() << m_job_name.toLocal8Bit() << " progress: " << num_succeeded << "/" << downloads.size(); if (num_failed + num_succeeded == downloads.size()) { if (num_failed) { - qDebug() << m_job_name.toLocal8Bit() << " failed."; + QLOG_ERROR() << m_job_name.toLocal8Bit() << " failed."; emit failed(); } else { - qDebug() << m_job_name.toLocal8Bit() << " succeeded."; + QLOG_INFO() << m_job_name.toLocal8Bit() << " succeeded."; emit succeeded(); } } @@ -76,17 +76,17 @@ void DownloadJob::partFailed(int index) auto &slot = parts_progress[index]; if (slot.failures == 3) { - qDebug() << "Part " << index << " failed 3 times (" << downloads[index]->m_url << ")"; + QLOG_ERROR() << "Part " << index << " failed 3 times (" << downloads[index]->m_url << ")"; num_failed++; if (num_failed + num_succeeded == downloads.size()) { - qDebug() << m_job_name.toLocal8Bit() << " failed."; + QLOG_ERROR() << m_job_name.toLocal8Bit() << " failed."; emit failed(); } } else { - qDebug() << "Part " << index << " failed, restarting (" << downloads[index]->m_url + QLOG_ERROR() << "Part " << index << " failed, restarting (" << downloads[index]->m_url << ")"; // restart the job slot.failures++; @@ -110,12 +110,12 @@ void DownloadJob::partProgress(int index, qint64 bytesReceived, qint64 bytesTota void DownloadJob::start() { - qDebug() << m_job_name.toLocal8Bit() << " started."; + QLOG_INFO() << m_job_name.toLocal8Bit() << " started."; for (auto iter : downloads) { - connect(iter.data(), SIGNAL(succeeded(int)), SLOT(partSucceeded(int))); - connect(iter.data(), SIGNAL(failed(int)), SLOT(partFailed(int))); - connect(iter.data(), SIGNAL(progress(int, qint64, qint64)), + connect(iter.get(), SIGNAL(succeeded(int)), SLOT(partSucceeded(int))); + connect(iter.get(), SIGNAL(failed(int)), SLOT(partFailed(int))); + connect(iter.get(), SIGNAL(progress(int, qint64, qint64)), SLOT(partProgress(int, qint64, qint64))); iter->start(); } |