SCRATCH nuke the overcomplicated logger, use a simple one.

This commit is contained in:
Petr Mrázek 2015-02-02 02:14:14 +01:00
parent 28a39ef7ac
commit cd9d37aac4
71 changed files with 415 additions and 934 deletions

View File

@ -270,14 +270,6 @@ SET(MULTIMC_SOURCES
BuildConfig.h BuildConfig.h
${PROJECT_BINARY_DIR}/BuildConfig.cpp ${PROJECT_BINARY_DIR}/BuildConfig.cpp
# Logging
logger/QsDebugOutput.cpp
logger/QsDebugOutput.h
logger/QsLog.cpp
logger/QsLog.h
logger/QsLogDest.cpp
logger/QsLogDest.h
# GUI - general utilities # GUI - general utilities
gui/GuiUtil.h gui/GuiUtil.h
gui/GuiUtil.cpp gui/GuiUtil.cpp

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <exception> #include <exception>
#include <QString> #include <QString>
#include <logger/QsLog.h> #include <QDebug>
class MMCError : public std::exception class MMCError : public std::exception
{ {
@ -9,7 +9,7 @@ public:
MMCError(QString cause) MMCError(QString cause)
{ {
exceptionCause = cause; exceptionCause = cause;
QLOG_ERROR() << "Exception: " + cause; qCritical() << "Exception: " + cause;
}; };
virtual ~MMCError() noexcept {} virtual ~MMCError() noexcept {}
virtual const char *what() const noexcept virtual const char *what() const noexcept

View File

@ -10,6 +10,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QStringList> #include <QStringList>
#include <QDesktopServices> #include <QDesktopServices>
#include <QDebug>
#include "gui/dialogs/VersionSelectDialog.h" #include "gui/dialogs/VersionSelectDialog.h"
#include "logic/InstanceList.h" #include "logic/InstanceList.h"
@ -38,8 +39,7 @@
#include <xdgicon.h> #include <xdgicon.h>
#include "logic/settings/INISettingsObject.h" #include "logic/settings/INISettingsObject.h"
#include "logic/settings/Setting.h" #include "logic/settings/Setting.h"
#include "logger/QsLog.h"
#include "logger/QsLogDest.h"
#include "logic/trans/TranslationDownloader.h" #include "logic/trans/TranslationDownloader.h"
@ -52,6 +52,8 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar
setOrganizationName("MultiMC"); setOrganizationName("MultiMC");
setApplicationName("MultiMC5"); setApplicationName("MultiMC5");
startTime = QDateTime::currentDateTime();
setAttribute(Qt::AA_UseHighDpiPixmaps); setAttribute(Qt::AA_UseHighDpiPixmaps);
// Don't quit on hiding the last window // Don't quit on hiding the last window
this->setQuitOnLastWindowClosed(false); this->setQuitOnLastWindowClosed(false);
@ -129,7 +131,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar
{ {
// BAD STUFF. WHAT DO? // BAD STUFF. WHAT DO?
initLogger(); initLogger();
QLOG_ERROR() << "Failed to set work path. Will exit. NOW."; qCritical() << "Failed to set work path. Will exit. NOW.";
m_status = MultiMC::Failed; m_status = MultiMC::Failed;
return; return;
} }
@ -166,22 +168,22 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar
// init the logger // init the logger
initLogger(); initLogger();
QLOG_INFO() << "MultiMC 5, (c) 2013-2015 MultiMC Contributors"; qDebug() << "MultiMC 5, (c) 2013-2015 MultiMC Contributors";
QLOG_INFO() << "Version : " << BuildConfig.VERSION_STR; qDebug() << "Version : " << BuildConfig.VERSION_STR;
QLOG_INFO() << "Git commit : " << BuildConfig.GIT_COMMIT; qDebug() << "Git commit : " << BuildConfig.GIT_COMMIT;
if (adjustedBy.size()) if (adjustedBy.size())
{ {
QLOG_INFO() << "Work dir before adjustment : " << origcwdPath; qDebug() << "Work dir before adjustment : " << origcwdPath;
QLOG_INFO() << "Work dir after adjustment : " << QDir::currentPath(); qDebug() << "Work dir after adjustment : " << QDir::currentPath();
QLOG_INFO() << "Adjusted by : " << adjustedBy; qDebug() << "Adjusted by : " << adjustedBy;
} }
else else
{ {
QLOG_INFO() << "Work dir : " << QDir::currentPath(); qDebug() << "Work dir : " << QDir::currentPath();
} }
QLOG_INFO() << "Binary path : " << binPath; qDebug() << "Binary path : " << binPath;
QLOG_INFO() << "Application root path : " << rootPath; qDebug() << "Application root path : " << rootPath;
QLOG_INFO() << "Static data path : " << staticDataPath; qDebug() << "Static data path : " << staticDataPath;
// load settings // load settings
initGlobalSettings(test_mode); initGlobalSettings(test_mode);
@ -202,21 +204,21 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar
// instance path: check for problems with '!' in instance path and warn the user in the log // instance path: check for problems with '!' in instance path and warn the user in the log
// and rememer that we have to show him a dialog when the gui starts (if it does so) // and rememer that we have to show him a dialog when the gui starts (if it does so)
QString instDir = m_settings->get("InstanceDir").toString(); QString instDir = m_settings->get("InstanceDir").toString();
QLOG_INFO() << "Instance path : " << instDir; qDebug() << "Instance path : " << instDir;
if (checkProblemticPathJava(QDir(instDir))) if (checkProblemticPathJava(QDir(instDir)))
{ {
QLOG_WARN() qWarning()
<< "Your instance path contains \'!\' and this is known to cause java problems"; << "Your instance path contains \'!\' and this is known to cause java problems";
} }
m_instances.reset(new InstanceList(m_settings, InstDirSetting->get().toString(), this)); m_instances.reset(new InstanceList(m_settings, InstDirSetting->get().toString(), this));
QLOG_INFO() << "Loading Instances..."; qDebug() << "Loading Instances...";
m_instances->loadList(); m_instances->loadList();
connect(InstDirSetting.get(), SIGNAL(SettingChanged(const Setting &, QVariant)), connect(InstDirSetting.get(), SIGNAL(SettingChanged(const Setting &, QVariant)),
m_instances.get(), SLOT(on_InstFolderChanged(const Setting &, QVariant))); m_instances.get(), SLOT(on_InstFolderChanged(const Setting &, QVariant)));
// and accounts // and accounts
m_accounts.reset(new MojangAccountList(this)); m_accounts.reset(new MojangAccountList(this));
QLOG_INFO() << "Loading accounts..."; qDebug() << "Loading accounts...";
m_accounts->setListFilePath("accounts.json", true); m_accounts->setListFilePath("accounts.json", true);
m_accounts->loadList(); m_accounts->loadList();
@ -275,16 +277,16 @@ void MultiMC::initTranslations()
{ {
QLocale locale(m_settings->get("Language").toString()); QLocale locale(m_settings->get("Language").toString());
QLocale::setDefault(locale); QLocale::setDefault(locale);
QLOG_INFO() << "Your language is" << locale.bcp47Name(); qDebug() << "Your language is" << locale.bcp47Name();
m_qt_translator.reset(new QTranslator()); m_qt_translator.reset(new QTranslator());
if (m_qt_translator->load("qt_" + locale.bcp47Name(), if (m_qt_translator->load("qt_" + locale.bcp47Name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath))) QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
{ {
QLOG_DEBUG() << "Loading Qt Language File for" qDebug() << "Loading Qt Language File for"
<< locale.bcp47Name().toLocal8Bit().constData() << "..."; << locale.bcp47Name().toLocal8Bit().constData() << "...";
if (!installTranslator(m_qt_translator.get())) if (!installTranslator(m_qt_translator.get()))
{ {
QLOG_ERROR() << "Loading Qt Language File failed."; qCritical() << "Loading Qt Language File failed.";
m_qt_translator.reset(); m_qt_translator.reset();
} }
} }
@ -296,11 +298,11 @@ void MultiMC::initTranslations()
m_mmc_translator.reset(new QTranslator()); m_mmc_translator.reset(new QTranslator());
if (m_mmc_translator->load("mmc_" + locale.bcp47Name(), staticDataPath + "/translations")) if (m_mmc_translator->load("mmc_" + locale.bcp47Name(), staticDataPath + "/translations"))
{ {
QLOG_DEBUG() << "Loading MMC Language File for" qDebug() << "Loading MMC Language File for"
<< locale.bcp47Name().toLocal8Bit().constData() << "..."; << locale.bcp47Name().toLocal8Bit().constData() << "...";
if (!installTranslator(m_mmc_translator.get())) if (!installTranslator(m_mmc_translator.get()))
{ {
QLOG_ERROR() << "Loading MMC Language File failed."; qCritical() << "Loading MMC Language File failed.";
m_mmc_translator.reset(); m_mmc_translator.reset();
} }
} }
@ -327,6 +329,28 @@ void moveFile(const QString &oldName, const QString &newName)
QFile::copy(oldName, newName); QFile::copy(oldName, newName);
QFile::remove(oldName); QFile::remove(oldName);
} }
void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
const char *levels = "DWCF";
const QString format("%1 %2 %3\n");
qint64 msecstotal = MMC->timeSinceStart();
qint64 seconds = msecstotal / 1000;
qint64 msecs = msecstotal % 1000;
QString foo;
char buf[1025] = {0};
::snprintf(buf, 1024, "%5lld.%03lld", seconds, msecs);
QString out = format.arg(buf).arg(levels[type]).arg(msg);
MMC->logFile->write(out.toUtf8());
MMC->logFile->flush();
QTextStream(stderr) << out.toLocal8Bit();
fflush(stderr);
}
void MultiMC::initLogger() void MultiMC::initLogger()
{ {
static const QString logBase = "MultiMC-%0.log"; static const QString logBase = "MultiMC-%0.log";
@ -336,15 +360,10 @@ void MultiMC::initLogger()
moveFile(logBase.arg(1), logBase.arg(2)); moveFile(logBase.arg(1), logBase.arg(2));
moveFile(logBase.arg(0), logBase.arg(1)); moveFile(logBase.arg(0), logBase.arg(1));
// init the logging mechanism qInstallMessageHandler(appDebugOutput);
QsLogging::Logger &logger = QsLogging::Logger::instance();
logger.setLoggingLevel(QsLogging::TraceLevel); logFile = std::make_shared<QFile>(logBase.arg(0));
m_fileDestination = QsLogging::DestinationFactory::MakeFileDestination(logBase.arg(0)); logFile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
m_debugDestination = QsLogging::DestinationFactory::MakeDebugOutputDestination();
logger.addDestination(m_fileDestination.get());
logger.addDestination(m_debugDestination.get());
// log all the things
logger.setLoggingLevel(QsLogging::TraceLevel);
} }
void MultiMC::initGlobalSettings(bool test_mode) void MultiMC::initGlobalSettings(bool test_mode)
@ -381,7 +400,7 @@ void MultiMC::initGlobalSettings(bool test_mode)
QFontInfo consoleFontInfo(consoleFont); QFontInfo consoleFontInfo(consoleFont);
QString resolvedDefaultMonospace = consoleFontInfo.family(); QString resolvedDefaultMonospace = consoleFontInfo.family();
QFont resolvedFont(resolvedDefaultMonospace); QFont resolvedFont(resolvedDefaultMonospace);
QLOG_DEBUG() << "Detected default console font:" << resolvedDefaultMonospace qDebug() << "Detected default console font:" << resolvedDefaultMonospace
<< ", substitutions:" << resolvedFont.substitutions().join(','); << ", substitutions:" << resolvedFont.substitutions().join(',');
m_settings->registerSetting("ConsoleFont", resolvedDefaultMonospace); m_settings->registerSetting("ConsoleFont", resolvedDefaultMonospace);
} }
@ -527,7 +546,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags)
m_updateOnExitFlags = None; m_updateOnExitFlags = None;
m_updateOnExitPath.clear(); m_updateOnExitPath.clear();
} }
QLOG_INFO() << "Installing updates."; qDebug() << "Installing updates.";
#ifdef WINDOWS #ifdef WINDOWS
QString finishCmd = applicationFilePath(); QString finishCmd = applicationFilePath();
QString updaterBinary = PathCombine(applicationDirPath(), "updater.exe"); QString updaterBinary = PathCombine(applicationDirPath(), "updater.exe");
@ -555,12 +574,12 @@ void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags)
args << "--finish-cmd" << finishCmd; args << "--finish-cmd" << finishCmd;
args << "--finish-dir" << dataPath; args << "--finish-dir" << dataPath;
} }
QLOG_INFO() << "Running updater with command" << updaterBinary << args.join(" "); qDebug() << "Running updater with command" << updaterBinary << args.join(" ");
QFile::setPermissions(updaterBinary, (QFileDevice::Permission)0x7755); QFile::setPermissions(updaterBinary, (QFileDevice::Permission)0x7755);
if (!QProcess::startDetached(updaterBinary, args /*, root()*/)) if (!QProcess::startDetached(updaterBinary, args /*, root()*/))
{ {
QLOG_ERROR() << "Failed to start the updater process!"; qCritical() << "Failed to start the updater process!";
return; return;
} }
@ -590,6 +609,11 @@ void MultiMC::onExit()
installUpdates(m_updateOnExitPath, m_updateOnExitFlags); installUpdates(m_updateOnExitPath, m_updateOnExitFlags);
} }
ENV.destroy(); ENV.destroy();
if(logFile)
{
logFile->flush();
logFile->close();
}
} }
bool MultiMC::openJsonEditor(const QString &filename) bool MultiMC::openJsonEditor(const QString &filename)

View File

@ -2,11 +2,12 @@
#include <QApplication> #include <QApplication>
#include <memory> #include <memory>
#include "logger/QsLog.h" #include <QDebug>
#include "logger/QsLogDest.h"
#include <QFlag> #include <QFlag>
#include <QIcon> #include <QIcon>
#include <QDateTime>
class QFile;
class MinecraftVersionList; class MinecraftVersionList;
class LWJGLVersionList; class LWJGLVersionList;
class HttpMetaCache; class HttpMetaCache;
@ -62,7 +63,10 @@ public:
return m_settings; return m_settings;
} }
qint64 timeSinceStart() const
{
return startTime.msecsTo(QDateTime::currentDateTime());
}
QIcon getThemedIcon(const QString& name); QIcon getThemedIcon(const QString& name);
@ -153,6 +157,8 @@ private:
friend class UpdateCheckerTest; friend class UpdateCheckerTest;
friend class DownloadUpdateTaskTest; friend class DownloadUpdateTaskTest;
QDateTime startTime;
std::shared_ptr<QTranslator> m_qt_translator; std::shared_ptr<QTranslator> m_qt_translator;
std::shared_ptr<QTranslator> m_mmc_translator; std::shared_ptr<QTranslator> m_mmc_translator;
std::shared_ptr<SettingsObject> m_settings; std::shared_ptr<SettingsObject> m_settings;
@ -169,9 +175,6 @@ private:
QMap<QString, std::shared_ptr<BaseProfilerFactory>> m_profilers; QMap<QString, std::shared_ptr<BaseProfilerFactory>> m_profilers;
QMap<QString, std::shared_ptr<BaseDetachedToolFactory>> m_tools; QMap<QString, std::shared_ptr<BaseDetachedToolFactory>> m_tools;
QsLogging::DestinationPtr m_fileDestination;
QsLogging::DestinationPtr m_debugDestination;
QString m_updateOnExitPath; QString m_updateOnExitPath;
UpdateFlags m_updateOnExitFlags = None; UpdateFlags m_updateOnExitFlags = None;
@ -180,4 +183,6 @@ private:
QString dataPath; QString dataPath;
Status m_status = MultiMC::Failed; Status m_status = MultiMC::Failed;
public:
std::shared_ptr<QFile> logFile;
}; };

View File

@ -916,7 +916,7 @@ void MainWindow::updateAvailable(QString repo, QString versionName, int versionI
switch (action) switch (action)
{ {
case UPDATE_LATER: case UPDATE_LATER:
QLOG_INFO() << "Update will be installed later."; qDebug() << "Update will be installed later.";
break; break;
case UPDATE_NOW: case UPDATE_NOW:
downloadUpdates(repo, versionId); downloadUpdates(repo, versionId);
@ -975,7 +975,7 @@ void MainWindow::notificationsChanged()
void MainWindow::downloadUpdates(QString repo, int versionId, bool installOnExit) void MainWindow::downloadUpdates(QString repo, int versionId, bool installOnExit)
{ {
QLOG_INFO() << "Downloading updates."; qDebug() << "Downloading updates.";
// TODO: If the user chooses to update on exit, we should download updates in the // TODO: If the user chooses to update on exit, we should download updates in the
// background. // background.
// Doing so is a bit complicated, because we'd have to make sure it finished downloading // Doing so is a bit complicated, because we'd have to make sure it finished downloading
@ -1086,7 +1086,7 @@ void MainWindow::instanceFromZipPack(QString instName, QString instGroup, QStrin
QTemporaryDir extractTmpDir; QTemporaryDir extractTmpDir;
QDir extractDir(extractTmpDir.path()); QDir extractDir(extractTmpDir.path());
QLOG_INFO() << "Attempting to create instance from" << archivePath; qDebug() << "Attempting to create instance from" << archivePath;
if (JlCompress::extractDir(archivePath, extractDir.absolutePath()).isEmpty()) if (JlCompress::extractDir(archivePath, extractDir.absolutePath()).isEmpty())
{ {
CustomMessageBox::selectable(this, tr("Error"), CustomMessageBox::selectable(this, tr("Error"),
@ -1730,7 +1730,7 @@ void MainWindow::doLaunch(bool online, BaseProfilerFactory *profiler)
{ {
case AuthSession::Undetermined: case AuthSession::Undetermined:
{ {
QLOG_ERROR() << "Received undetermined session status during login. Bye."; qCritical() << "Received undetermined session status during login. Bye.";
tryagain = false; tryagain = false;
break; break;
} }
@ -2004,7 +2004,7 @@ void MainWindow::checkSetDefaultJava()
if (askForJava) if (askForJava)
{ {
QLOG_DEBUG() << "Java path needs resetting, showing Java selection dialog..."; qDebug() << "Java path needs resetting, showing Java selection dialog...";
JavaVersionPtr java; JavaVersionPtr java;

View File

@ -18,7 +18,7 @@
#include <QItemSelectionModel> #include <QItemSelectionModel>
#include <logger/QsLog.h> #include <QDebug>
#include <gui/dialogs/ProgressDialog.h> #include <gui/dialogs/ProgressDialog.h>
@ -40,7 +40,7 @@ AccountSelectDialog::AccountSelectDialog(const QString &message, int flags, QWid
// Flags... // Flags...
ui->globalDefaultCheck->setVisible(flags & GlobalDefaultCheckbox); ui->globalDefaultCheck->setVisible(flags & GlobalDefaultCheckbox);
ui->instDefaultCheck->setVisible(flags & InstanceDefaultCheckbox); ui->instDefaultCheck->setVisible(flags & InstanceDefaultCheckbox);
QLOG_DEBUG() << flags; qDebug() << flags;
// Select the first entry in the list. // Select the first entry in the list.
ui->listView->setCurrentIndex(ui->listView->model()->index(0, 0)); ui->listView->setCurrentIndex(ui->listView->model()->index(0, 0));

View File

@ -1,7 +1,7 @@
#include "UpdateDialog.h" #include "UpdateDialog.h"
#include "ui_UpdateDialog.h" #include "ui_UpdateDialog.h"
#include "gui/Platform.h" #include "gui/Platform.h"
#include "logger/QsLog.h" #include <QDebug>
#include "MultiMC.h" #include "MultiMC.h"
#include <logic/settings/SettingsObject.h> #include <logic/settings/SettingsObject.h>
@ -82,7 +82,7 @@ QString reprocessMarkdown(QString markdown)
html << "<ul>\n"; html << "<ul>\n";
html << "<li>" << procLine(line.mid(2)) << "</li>\n"; html << "<li>" << procLine(line.mid(2)) << "</li>\n";
} }
else QLOG_ERROR() << "Invalid input on line " << i << ": " << line; else qCritical() << "Invalid input on line " << i << ": " << line;
break; break;
case LIST1: case LIST1:
if(line.startsWith("##")) if(line.startsWith("##"))
@ -107,7 +107,7 @@ QString reprocessMarkdown(QString markdown)
html << "<ul>\n"; html << "<ul>\n";
html << "<li>" << procLine(line.mid(4)) << "</li>\n"; html << "<li>" << procLine(line.mid(4)) << "</li>\n";
} }
else QLOG_ERROR() << "Invalid input on line " << i << ": " << line; else qCritical() << "Invalid input on line " << i << ": " << line;
break; break;
case LIST2: case LIST2:
if(line.startsWith("##")) if(line.startsWith("##"))
@ -134,7 +134,7 @@ QString reprocessMarkdown(QString markdown)
{ {
html << "<li>" << procLine(line.mid(4)) << "</li>\n"; html << "<li>" << procLine(line.mid(4)) << "</li>\n";
} }
else QLOG_ERROR() << "Invalid input on line " << i << ": " << line; else qCritical() << "Invalid input on line " << i << ": " << line;
break; break;
} }
i++; i++;
@ -151,10 +151,10 @@ QString reprocessMarkdown(QString markdown)
} }
if (state != BASE) if (state != BASE)
{ {
QLOG_ERROR() << "Reprocessing markdown didn't end in a final state!"; qCritical() << "Reprocessing markdown didn't end in a final state!";
} }
html << "</html>\n"; html << "</html>\n";
QLOG_DEBUG() << htmlData; qDebug() << htmlData;
return htmlData; return htmlData;
} }

View File

@ -25,7 +25,7 @@
#include <logic/BaseVersionList.h> #include <logic/BaseVersionList.h>
#include <logic/tasks/Task.h> #include <logic/tasks/Task.h>
#include <depends/util/include/modutils.h> #include <depends/util/include/modutils.h>
#include "logger/QsLog.h" #include <QDebug>
class VersionSelectProxyModel : public QSortFilterProxyModel class VersionSelectProxyModel : public QSortFilterProxyModel
{ {

View File

@ -12,7 +12,7 @@
#include <QScrollBar> #include <QScrollBar>
#include "VisualGroup.h" #include "VisualGroup.h"
#include "logger/QsLog.h" #include <QDebug>
template <typename T> bool listsIntersect(const QList<T> &l1, const QList<T> t2) template <typename T> bool listsIntersect(const QList<T> &l1, const QList<T> t2)
{ {

View File

@ -1,7 +1,7 @@
#include "GroupedProxyModel.h" #include "GroupedProxyModel.h"
#include "GroupView.h" #include "GroupView.h"
#include "logger/QsLog.h" #include <QDebug>
GroupedProxyModel::GroupedProxyModel(QObject *parent) : QSortFilterProxyModel(parent) GroupedProxyModel::GroupedProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
{ {
@ -21,16 +21,16 @@ bool GroupedProxyModel::lessThan(const QModelIndex &left, const QModelIndex &rig
auto result = leftCategory.localeAwareCompare(rightCategory); auto result = leftCategory.localeAwareCompare(rightCategory);
if(result < 0) if(result < 0)
{ {
QLOG_DEBUG() << leftCategory << "<" << rightCategory; qDebug() << leftCategory << "<" << rightCategory;
} }
if(result == 0) if(result == 0)
{ {
QLOG_DEBUG() << leftCategory << "=" << rightCategory; qDebug() << leftCategory << "=" << rightCategory;
return subSortLessThan(left, right); return subSortLessThan(left, right);
} }
if(result > 0) if(result > 0)
{ {
QLOG_DEBUG() << leftCategory << ">" << rightCategory; qDebug() << leftCategory << ">" << rightCategory;
} }
return result < 0; return result < 0;
} }

View File

@ -18,7 +18,7 @@
#include <QItemSelectionModel> #include <QItemSelectionModel>
#include <logger/QsLog.h> #include <QDebug>
#include "logic/net/NetJob.h" #include "logic/net/NetJob.h"
#include "logic/net/URLConstants.h" #include "logic/net/URLConstants.h"

View File

@ -212,7 +212,7 @@ void MultiMCPage::refreshUpdateChannelList()
// the combo box to it. // the combo box to it.
if (entry.id == m_currentUpdateChannel) if (entry.id == m_currentUpdateChannel)
{ {
QLOG_DEBUG() << "Selected index" << i << "channel id" << m_currentUpdateChannel; qDebug() << "Selected index" << i << "channel id" << m_currentUpdateChannel;
selection = i; selection = i;
} }
} }

View File

@ -1,52 +0,0 @@
// Copyright (c) 2010, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#include "QsDebugOutput.h"
#include <QString>
#include <QtGlobal>
#if defined(Q_OS_WIN)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
void QsDebugOutput::output(const QString &message)
{
OutputDebugStringW(reinterpret_cast<const WCHAR *>(message.utf16()));
OutputDebugStringW(L"\n");
}
#elif defined(Q_OS_SYMBIAN)
#include <e32debug.h>
void QsDebugOutput::output(const QString &message)
{
TPtrC8 symbianMessage(reinterpret_cast<const TUint8 *>(qPrintable(message)));
RDebug::RawPrint(symbianMessage);
}
#elif defined(Q_OS_UNIX)
#include <cstdio>
void QsDebugOutput::output(const QString &message)
{
fprintf(stderr, "%s\n", qPrintable(message));
fflush(stderr);
}
#endif

View File

@ -1,34 +0,0 @@
// Copyright (c) 2010, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
class QString;
class QsDebugOutput
{
public:
static void output(const QString &a_message);
};

View File

@ -1,159 +0,0 @@
// Copyright (c) 2010, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#include "QsLog.h"
#include "QsLogDest.h"
#include <QMutex>
#include <QList>
#include <QDateTime>
#include <QtGlobal>
#include <cassert>
#include <cstdlib>
#include <stdexcept>
namespace QsLogging
{
typedef QList<Destination *> DestinationList;
static const char *LevelStrings[] = {"TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "UNKNOWN"};
static const char *LevelToText(Level theLevel)
{
if (theLevel > FatalLevel)
{
assert(!"bad log level");
return LevelStrings[UnknownLevel];
}
return LevelStrings[theLevel];
}
class LoggerImpl
{
public:
LoggerImpl() : level(InfoLevel)
{
}
QMutex logMutex;
Level level;
DestinationList destList;
QDateTime startTime;
};
Logger::Logger() : d(new LoggerImpl)
{
d->startTime = QDateTime::currentDateTime();
}
Logger::~Logger()
{
delete d;
}
void Logger::addDestination(Destination *destination)
{
assert(destination);
d->destList.push_back(destination);
}
void Logger::setLoggingLevel(Level newLevel)
{
d->level = newLevel;
}
Level Logger::loggingLevel() const
{
return d->level;
}
QDateTime Logger::timeOfStart() const
{
return d->startTime;
}
qint64 Logger::timeSinceStart() const
{
return d->startTime.msecsTo(QDateTime::currentDateTime());
}
//! creates the complete log message and passes it to the logger
void Logger::Helper::writeToLog()
{
const char *const levelName = LevelToText(level);
Logger &logger = Logger::instance();
qint64 msecstotal = logger.timeSinceStart();
qint64 seconds = msecstotal / 1000;
qint64 msecs = msecstotal % 1000;
QString foo;
char buf[1024];
::snprintf(buf, 1024, "%5lld.%03lld", seconds, msecs);
const QString completeMessage(QString("%1\t%2\t%3").arg(buf).arg(levelName, 5).arg(buffer));
QMutexLocker lock(&logger.d->logMutex);
logger.write(completeMessage);
}
Logger::Helper::Helper(Level logLevel) : level(logLevel), qtDebug(&buffer)
{
}
Logger::Helper::~Helper()
{
try
{
writeToLog();
}
catch (std::exception &e)
{
// you shouldn't throw exceptions from a sink
Q_UNUSED(e);
assert(!"exception in logger helper destructor");
throw;
}
}
//! sends the message to all the destinations
void Logger::write(const QString &message)
{
for (DestinationList::iterator it = d->destList.begin(), endIt = d->destList.end();
it != endIt; ++it)
{
if (!(*it))
{
assert(!"null log destination");
continue;
}
(*it)->write(message);
}
}
void Logger::removeDestination(Destination* destination)
{
d->destList.removeAll(destination);
}
} // end namespace

View File

@ -1,138 +0,0 @@
// Copyright (c) 2010, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include <QDebug>
#include <QString>
#include <QDateTime>
namespace QsLogging
{
class Destination;
enum Level
{
TraceLevel = 0,
DebugLevel,
InfoLevel,
WarnLevel,
ErrorLevel,
FatalLevel,
UnknownLevel
};
class LoggerImpl; // d pointer
class Logger
{
public:
static Logger &instance()
{
static Logger staticLog;
return staticLog;
}
//! Adds a log message destination. Don't add null destinations.
void addDestination(Destination *destination);
//! Removes the given destination from the logger.
void removeDestination(Destination* destination);
//! Logging at a level < 'newLevel' will be ignored
void setLoggingLevel(Level newLevel);
//! The default level is INFO
Level loggingLevel() const;
//! msecs since the logger was initialized
qint64 timeSinceStart() const;
//! time when the logger was initialized
QDateTime timeOfStart() const;
//! The helper forwards the streaming to QDebug and builds the final
//! log message.
class Helper
{
public:
explicit Helper(Level logLevel);
~Helper();
QDebug &stream()
{
return qtDebug;
}
private:
void writeToLog();
Level level;
QString buffer;
QDebug qtDebug;
};
private:
Logger();
Logger(const Logger &);
Logger &operator=(const Logger &);
~Logger();
void write(const QString &message);
LoggerImpl *d;
};
} // end namespace
#define QLOG_TRACE() \
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::TraceLevel) \
QsLogging::Logger::Helper(QsLogging::TraceLevel).stream()
#define QLOG_DEBUG() \
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::DebugLevel) \
QsLogging::Logger::Helper(QsLogging::DebugLevel).stream()
#define QLOG_INFO() \
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::InfoLevel) \
QsLogging::Logger::Helper(QsLogging::InfoLevel).stream()
#define QLOG_WARN() \
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::WarnLevel) \
QsLogging::Logger::Helper(QsLogging::WarnLevel).stream()
#define QLOG_ERROR() \
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::ErrorLevel) \
QsLogging::Logger::Helper(QsLogging::ErrorLevel).stream()
#define QLOG_FATAL() QsLogging::Logger::Helper(QsLogging::FatalLevel).stream()
/*
#define QLOG_TRACE() \
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::TraceLevel) \
QsLogging::Logger::Helper(QsLogging::TraceLevel).stream() << __FILE__ << '@' << __LINE__
#define QLOG_DEBUG() \
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::DebugLevel) \
QsLogging::Logger::Helper(QsLogging::DebugLevel).stream() << __FILE__ << '@' << __LINE__
#define QLOG_INFO() \
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::InfoLevel) \
QsLogging::Logger::Helper(QsLogging::InfoLevel).stream() << __FILE__ << '@' << __LINE__
#define QLOG_WARN() \
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::WarnLevel) \
QsLogging::Logger::Helper(QsLogging::WarnLevel).stream() << __FILE__ << '@' << __LINE__
#define QLOG_ERROR() \
if (QsLogging::Logger::instance().loggingLevel() <= QsLogging::ErrorLevel) \
QsLogging::Logger::Helper(QsLogging::ErrorLevel).stream() << __FILE__ << '@' << __LINE__
#define QLOG_FATAL() \
QsLogging::Logger::Helper(QsLogging::FatalLevel).stream() << __FILE__ << '@' << __LINE__
*/

View File

@ -1,104 +0,0 @@
// Copyright (c) 2010, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#include "QsLogDest.h"
#include "QsDebugOutput.h"
#include "QsLog.h"
#include <QFile>
#include <QTextStream>
#include <QString>
namespace QsLogging
{
Destination::~Destination()
{
Logger::instance().removeDestination(this);
QsDebugOutput::output("Removed logger destination.");
}
//! file message sink
class FileDestination : public Destination
{
public:
FileDestination(const QString &filePath);
virtual void write(const QString &message);
private:
QFile mFile;
QTextStream mOutputStream;
};
FileDestination::FileDestination(const QString &filePath)
{
mFile.setFileName(filePath);
mFile.open(QFile::WriteOnly | QFile::Text |
QFile::Truncate); // fixme: should throw on failure
mOutputStream.setDevice(&mFile);
}
void FileDestination::write(const QString &message)
{
mOutputStream << message << endl;
mOutputStream.flush();
}
//! debugger sink
class DebugOutputDestination : public Destination
{
public:
virtual void write(const QString &message);
};
void DebugOutputDestination::write(const QString &message)
{
QsDebugOutput::output(message);
}
class QDebugDestination : public Destination
{
public:
virtual void write(const QString &message)
{
qDebug() << message;
};
};
DestinationPtr DestinationFactory::MakeFileDestination(const QString &filePath)
{
return DestinationPtr(new FileDestination(filePath));
}
DestinationPtr DestinationFactory::MakeDebugOutputDestination()
{
return DestinationPtr(new DebugOutputDestination);
}
DestinationPtr DestinationFactory::MakeQDebugDestination()
{
return DestinationPtr(new QDebugDestination);
}
} // end namespace

View File

@ -1,53 +0,0 @@
// Copyright (c) 2010, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include <memory>
class QString;
namespace QsLogging
{
class Destination
{
public:
virtual ~Destination();
virtual void write(const QString &message) = 0;
};
typedef std::shared_ptr<Destination> DestinationPtr;
//! Creates logging destinations/sinks. The caller will have ownership of
//! the newly created destinations.
class DestinationFactory
{
public:
static DestinationPtr MakeFileDestination(const QString &filePath);
static DestinationPtr MakeDebugOutputDestination();
static DestinationPtr MakeQDebugDestination();
};
} // end namespace

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include "logic/BaseProcess.h" #include "logic/BaseProcess.h"
#include "logger/QsLog.h" #include <QDebug>
#include <QDir> #include <QDir>
#include <QEventLoop> #include <QEventLoop>
@ -71,20 +71,20 @@ void BaseProcess::init()
// filter out dangerous java crap // filter out dangerous java crap
if(ignored.contains(key)) if(ignored.contains(key))
{ {
QLOG_INFO() << "Env: ignoring" << key << value; qDebug() << "Env: ignoring" << key << value;
continue; continue;
} }
// filter MultiMC-related things // filter MultiMC-related things
if(key.startsWith("QT_")) if(key.startsWith("QT_"))
{ {
QLOG_INFO() << "Env: ignoring" << key << value; qDebug() << "Env: ignoring" << key << value;
continue; continue;
} }
#ifdef LINUX #ifdef LINUX
// Do not pass LD_* variables to java. They were intended for MultiMC // Do not pass LD_* variables to java. They were intended for MultiMC
if(key.startsWith("LD_")) if(key.startsWith("LD_"))
{ {
QLOG_INFO() << "Env: ignoring" << key << value; qDebug() << "Env: ignoring" << key << value;
continue; continue;
} }
// Strip IBus // Strip IBus
@ -93,10 +93,10 @@ void BaseProcess::init()
{ {
QString save = value; QString save = value;
value.replace(IBUS, ""); value.replace(IBUS, "");
QLOG_INFO() << "Env: stripped" << IBUS << "from" << save << ":" << value; qDebug() << "Env: stripped" << IBUS << "from" << save << ":" << value;
} }
#endif #endif
QLOG_INFO() << "Env: " << key << value; qDebug() << "Env: " << key << value;
env.insert(key, value); env.insert(key, value);
} }
#ifdef LINUX #ifdef LINUX

View File

@ -6,7 +6,7 @@
#include <QDir> #include <QDir>
#include <QNetworkProxy> #include <QNetworkProxy>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include "logger/QsLog.h" #include <QDebug>
#include "logic/tasks/Task.h" #include "logic/tasks/Task.h"
#include <QDebug> #include <QDebug>
@ -175,14 +175,14 @@ void Env::updateProxySettings(QString proxyTypeStr, QString addr, int port, QStr
QNetworkProxyFactory::setUseSystemConfiguration(true); QNetworkProxyFactory::setUseSystemConfiguration(true);
} }
QLOG_INFO() << "Detecting proxy settings..."; qDebug() << "Detecting proxy settings...";
QNetworkProxy proxy = QNetworkProxy::applicationProxy(); QNetworkProxy proxy = QNetworkProxy::applicationProxy();
if (m_qnam.get()) if (m_qnam.get())
m_qnam->setProxy(proxy); m_qnam->setProxy(proxy);
QString proxyDesc; QString proxyDesc;
if (proxy.type() == QNetworkProxy::NoProxy) if (proxy.type() == QNetworkProxy::NoProxy)
{ {
QLOG_INFO() << "Using no proxy is an option!"; qDebug() << "Using no proxy is an option!";
return; return;
} }
switch (proxy.type()) switch (proxy.type())
@ -211,7 +211,7 @@ void Env::updateProxySettings(QString proxyTypeStr, QString addr, int port, QStr
.arg(proxy.port()) .arg(proxy.port())
.arg(proxy.user()) .arg(proxy.user())
.arg(proxy.password()); .arg(proxy.password());
QLOG_INFO() << proxyDesc; qDebug() << proxyDesc;
} }
#include "Env.moc" #include "Env.moc"

View File

@ -34,7 +34,7 @@
#include "settings/INISettingsObject.h" #include "settings/INISettingsObject.h"
#include "OneSixInstance.h" #include "OneSixInstance.h"
#include "LegacyInstance.h" #include "LegacyInstance.h"
#include "logger/QsLog.h" #include <QDebug>
const static int GROUP_FILE_FORMAT_VERSION = 1; const static int GROUP_FILE_FORMAT_VERSION = 1;
@ -138,7 +138,7 @@ void InstanceList::saveGroupList()
if (!groupFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) if (!groupFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
{ {
// An error occurred. Ignore it. // An error occurred. Ignore it.
QLOG_ERROR() << "Failed to save instance group file."; qCritical() << "Failed to save instance group file.";
return; return;
} }
QTextStream out(&groupFile); QTextStream out(&groupFile);
@ -202,7 +202,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap)
if (!groupFile.open(QIODevice::ReadOnly)) if (!groupFile.open(QIODevice::ReadOnly))
{ {
// An error occurred. Ignore it. // An error occurred. Ignore it.
QLOG_ERROR() << "Failed to read instance group file."; qCritical() << "Failed to read instance group file.";
return; return;
} }
@ -216,7 +216,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap)
// if the json was bad, fail // if the json was bad, fail
if (error.error != QJsonParseError::NoError) if (error.error != QJsonParseError::NoError)
{ {
QLOG_ERROR() << QString("Failed to parse instance group file: %1 at offset %2") qCritical() << QString("Failed to parse instance group file: %1 at offset %2")
.arg(error.errorString(), QString::number(error.offset)) .arg(error.errorString(), QString::number(error.offset))
.toUtf8(); .toUtf8();
return; return;
@ -225,7 +225,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap)
// if the root of the json wasn't an object, fail // if the root of the json wasn't an object, fail
if (!jsonDoc.isObject()) if (!jsonDoc.isObject())
{ {
QLOG_WARN() << "Invalid group file. Root entry should be an object."; qWarning() << "Invalid group file. Root entry should be an object.";
return; return;
} }
@ -238,7 +238,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap)
// Get the groups. if it's not an object, fail // Get the groups. if it's not an object, fail
if (!rootObj.value("groups").isObject()) if (!rootObj.value("groups").isObject())
{ {
QLOG_WARN() << "Invalid group list JSON: 'groups' should be an object."; qWarning() << "Invalid group list JSON: 'groups' should be an object.";
return; return;
} }
@ -251,7 +251,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap)
// If not an object, complain and skip to the next one. // If not an object, complain and skip to the next one.
if (!iter.value().isObject()) if (!iter.value().isObject())
{ {
QLOG_WARN() << QString("Group '%1' in the group list should " qWarning() << QString("Group '%1' in the group list should "
"be an object.") "be an object.")
.arg(groupName) .arg(groupName)
.toUtf8(); .toUtf8();
@ -261,7 +261,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap)
QJsonObject groupObj = iter.value().toObject(); QJsonObject groupObj = iter.value().toObject();
if (!groupObj.value("instances").isArray()) if (!groupObj.value("instances").isArray())
{ {
QLOG_WARN() << QString("Group '%1' in the group list is invalid. " qWarning() << QString("Group '%1' in the group list is invalid. "
"It should contain an array " "It should contain an array "
"called 'instances'.") "called 'instances'.")
.arg(groupName) .arg(groupName)
@ -298,7 +298,7 @@ InstanceList::InstListError InstanceList::loadList()
QString subDir = iter.next(); QString subDir = iter.next();
if (!QFileInfo(PathCombine(subDir, "instance.cfg")).exists()) if (!QFileInfo(PathCombine(subDir, "instance.cfg")).exists())
continue; continue;
QLOG_INFO() << "Loading MultiMC instance from " << subDir; qDebug() << "Loading MultiMC instance from " << subDir;
InstancePtr instPtr; InstancePtr instPtr;
auto error = loadInstance(instPtr, subDir); auto error = loadInstance(instPtr, subDir);
if(!continueProcessInstance(instPtr, error, subDir, groupMap)) if(!continueProcessInstance(instPtr, error, subDir, groupMap))
@ -410,12 +410,12 @@ bool InstanceList::continueProcessInstance(InstancePtr instPtr, const int error,
errorMsg += QString("Unknown instance loader error %1").arg(error); errorMsg += QString("Unknown instance loader error %1").arg(error);
break; break;
} }
QLOG_ERROR() << errorMsg.toUtf8(); qCritical() << errorMsg.toUtf8();
return false; return false;
} }
else if (!instPtr) else if (!instPtr)
{ {
QLOG_ERROR() << QString("Error loading instance %1. Instance loader returned null.") qCritical() << QString("Error loading instance %1. Instance loader returned null.")
.arg(QFileInfo(dir.absolutePath()).baseName()) .arg(QFileInfo(dir.absolutePath()).baseName())
.toUtf8(); .toUtf8();
return false; return false;
@ -427,7 +427,7 @@ bool InstanceList::continueProcessInstance(InstancePtr instPtr, const int error,
{ {
instPtr->setGroupInitial((*iter)); instPtr->setGroupInitial((*iter));
} }
QLOG_INFO() << "Loaded instance " << instPtr->name() << " from " << dir.absolutePath(); qDebug() << "Loaded instance " << instPtr->name() << " from " << dir.absolutePath();
return true; return true;
} }
} }
@ -463,16 +463,16 @@ InstanceList::createInstance(InstancePtr &inst, BaseVersionPtr version, const QS
{ {
QDir rootDir(instDir); QDir rootDir(instDir);
QLOG_DEBUG() << instDir.toUtf8(); qDebug() << instDir.toUtf8();
if (!rootDir.exists() && !rootDir.mkpath(".")) if (!rootDir.exists() && !rootDir.mkpath("."))
{ {
QLOG_ERROR() << "Can't create instance folder" << instDir; qCritical() << "Can't create instance folder" << instDir;
return InstanceList::CantCreateDir; return InstanceList::CantCreateDir;
} }
if (!version) if (!version)
{ {
QLOG_ERROR() << "Can't create instance for non-existing MC version"; qCritical() << "Can't create instance for non-existing MC version";
return InstanceList::NoSuchVersion; return InstanceList::NoSuchVersion;
} }
@ -497,7 +497,7 @@ InstanceList::copyInstance(InstancePtr &newInstance, InstancePtr &oldInstance, c
{ {
QDir rootDir(instDir); QDir rootDir(instDir);
QLOG_DEBUG() << instDir.toUtf8(); qDebug() << instDir.toUtf8();
if (!copyPath(oldInstance->instanceRoot(), instDir)) if (!copyPath(oldInstance->instanceRoot(), instDir))
{ {
rootDir.removeRecursively(); rootDir.removeRecursively();

View File

@ -2,7 +2,7 @@
#include <quazip.h> #include <quazip.h>
#include <quazipfile.h> #include <quazipfile.h>
#include <JlCompress.h> #include <JlCompress.h>
#include <logger/QsLog.h> #include <QDebug>
namespace JarUtils { namespace JarUtils {
@ -19,13 +19,13 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained,
QString filename = modZip.getCurrentFileName(); QString filename = modZip.getCurrentFileName();
if (!filter(filename)) if (!filter(filename))
{ {
QLOG_INFO() << "Skipping file " << filename << " from " qDebug() << "Skipping file " << filename << " from "
<< from.fileName() << " - filtered"; << from.fileName() << " - filtered";
continue; continue;
} }
if (contained.contains(filename)) if (contained.contains(filename))
{ {
QLOG_INFO() << "Skipping already contained file " << filename << " from " qDebug() << "Skipping already contained file " << filename << " from "
<< from.fileName(); << from.fileName();
continue; continue;
} }
@ -33,7 +33,7 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained,
if (!fileInsideMod.open(QIODevice::ReadOnly)) if (!fileInsideMod.open(QIODevice::ReadOnly))
{ {
QLOG_ERROR() << "Failed to open " << filename << " from " << from.fileName(); qCritical() << "Failed to open " << filename << " from " << from.fileName();
return false; return false;
} }
@ -41,7 +41,7 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained,
if (!zipOutFile.open(QIODevice::WriteOnly, info_out)) if (!zipOutFile.open(QIODevice::WriteOnly, info_out))
{ {
QLOG_ERROR() << "Failed to open " << filename << " in the jar"; qCritical() << "Failed to open " << filename << " in the jar";
fileInsideMod.close(); fileInsideMod.close();
return false; return false;
} }
@ -49,7 +49,7 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained,
{ {
zipOutFile.close(); zipOutFile.close();
fileInsideMod.close(); fileInsideMod.close();
QLOG_ERROR() << "Failed to copy data of " << filename << " into the jar"; qCritical() << "Failed to copy data of " << filename << " into the jar";
return false; return false;
} }
zipOutFile.close(); zipOutFile.close();
@ -64,7 +64,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M
if (!zipOut.open(QuaZip::mdCreate)) if (!zipOut.open(QuaZip::mdCreate))
{ {
QFile::remove(targetJarPath); QFile::remove(targetJarPath);
QLOG_ERROR() << "Failed to open the minecraft.jar for modding"; qCritical() << "Failed to open the minecraft.jar for modding";
return false; return false;
} }
// Files already added to the jar. // Files already added to the jar.
@ -86,7 +86,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M
{ {
zipOut.close(); zipOut.close();
QFile::remove(targetJarPath); QFile::remove(targetJarPath);
QLOG_ERROR() << "Failed to add" << mod.filename().fileName() << "to the jar."; qCritical() << "Failed to add" << mod.filename().fileName() << "to the jar.";
return false; return false;
} }
} }
@ -98,7 +98,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M
{ {
zipOut.close(); zipOut.close();
QFile::remove(targetJarPath); QFile::remove(targetJarPath);
QLOG_ERROR() << "Failed to add" << mod.filename().fileName() << "to the jar."; qCritical() << "Failed to add" << mod.filename().fileName() << "to the jar.";
return false; return false;
} }
addedFiles.insert(filename.fileName()); addedFiles.insert(filename.fileName());
@ -114,10 +114,10 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M
{ {
zipOut.close(); zipOut.close();
QFile::remove(targetJarPath); QFile::remove(targetJarPath);
QLOG_ERROR() << "Failed to add" << mod.filename().fileName() << "to the jar."; qCritical() << "Failed to add" << mod.filename().fileName() << "to the jar.";
return false; return false;
} }
QLOG_INFO() << "Adding folder " << filename.fileName() << " from " qDebug() << "Adding folder " << filename.fileName() << " from "
<< filename.absoluteFilePath(); << filename.absoluteFilePath();
} }
} }
@ -126,7 +126,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M
{ {
zipOut.close(); zipOut.close();
QFile::remove(targetJarPath); QFile::remove(targetJarPath);
QLOG_ERROR() << "Failed to insert minecraft.jar contents."; qCritical() << "Failed to insert minecraft.jar contents.";
return false; return false;
} }
@ -135,7 +135,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M
if (zipOut.getZipError() != 0) if (zipOut.getZipError() != 0)
{ {
QFile::remove(targetJarPath); QFile::remove(targetJarPath);
QLOG_ERROR() << "Failed to finalize minecraft.jar!"; qCritical() << "Failed to finalize minecraft.jar!";
return false; return false;
} }
return true; return true;

View File

@ -191,7 +191,7 @@ QList<Mod> LegacyInstance::getJarMods() const
void LegacyInstance::jarModsChanged() void LegacyInstance::jarModsChanged()
{ {
QLOG_INFO() << "Jar mods of instance " << name() << " have changed. Jar will be rebuilt."; qDebug() << "Jar mods of instance " << name() << " have changed. Jar will be rebuilt.";
setShouldRebuild(true); setShouldRebuild(true);
} }

View File

@ -28,7 +28,7 @@
#include "logic/Env.h" #include "logic/Env.h"
#include "logic/ModList.h" #include "logic/ModList.h"
#include "logger/QsLog.h" #include <QDebug>
#include "logic/net/URLConstants.h" #include "logic/net/URLConstants.h"
#include "JarUtils.h" #include "JarUtils.h"

View File

@ -20,7 +20,7 @@
#include <QtXml> #include <QtXml>
#include <QRegExp> #include <QRegExp>
#include "logger/QsLog.h" #include <QDebug>
#define RSS_URL "http://sourceforge.net/projects/java-game-lib/rss" #define RSS_URL "http://sourceforge.net/projects/java-game-lib/rss"
@ -131,7 +131,7 @@ void LWJGLVersionList::netRequestComplete()
QDomElement linkElement = getDomElementByTagName(items.at(i).toElement(), "link"); QDomElement linkElement = getDomElementByTagName(items.at(i).toElement(), "link");
if (linkElement.isNull()) if (linkElement.isNull())
{ {
QLOG_INFO() << "Link element" << i << "in RSS feed doesn't exist! Skipping."; qDebug() << "Link element" << i << "in RSS feed doesn't exist! Skipping.";
continue; continue;
} }
@ -147,10 +147,10 @@ void LWJGLVersionList::netRequestComplete()
QUrl url(link); QUrl url(link);
if (!url.isValid()) if (!url.isValid())
{ {
QLOG_WARN() << "LWJGL version URL isn't valid:" << link << "Skipping."; qWarning() << "LWJGL version URL isn't valid:" << link << "Skipping.";
continue; continue;
} }
QLOG_INFO() << "Discovered LWGL version" << name << "at" << link; qDebug() << "Discovered LWGL version" << name << "at" << link;
tempList.append(std::make_shared<LWJGLVersion>(name, link)); tempList.append(std::make_shared<LWJGLVersion>(name, link));
} }
} }
@ -159,7 +159,7 @@ void LWJGLVersionList::netRequestComplete()
m_vlist.swap(tempList); m_vlist.swap(tempList);
endResetModel(); endResetModel();
QLOG_INFO() << "Loaded LWJGL list."; qDebug() << "Loaded LWJGL list.";
finished(); finished();
} }
else else
@ -173,7 +173,7 @@ void LWJGLVersionList::netRequestComplete()
void LWJGLVersionList::failed(QString msg) void LWJGLVersionList::failed(QString msg)
{ {
QLOG_ERROR() << msg; qCritical() << msg;
emit loadListFailed(msg); emit loadListFailed(msg);
} }

View File

@ -25,7 +25,7 @@
#include "Mod.h" #include "Mod.h"
#include <pathutils.h> #include <pathutils.h>
#include "logic/settings/INIFile.h" #include "logic/settings/INIFile.h"
#include "logger/QsLog.h" #include <QDebug>
Mod::Mod(const QFileInfo &file) Mod::Mod(const QFileInfo &file)
{ {
@ -209,8 +209,8 @@ void Mod::ReadMCModInfo(QByteArray contents)
int version = val.toDouble(); int version = val.toDouble();
if (version != 2) if (version != 2)
{ {
QLOG_ERROR() << "BAD stuff happened to mod json:"; qCritical() << "BAD stuff happened to mod json:";
QLOG_ERROR() << contents; qCritical() << contents;
return; return;
} }
auto arrVal = jsonDoc.object().value("modlist"); auto arrVal = jsonDoc.object().value("modlist");
@ -273,7 +273,7 @@ bool Mod::replace(Mod &with)
if (t == MOD_ZIPFILE || t == MOD_SINGLEFILE || t == MOD_LITEMOD) if (t == MOD_ZIPFILE || t == MOD_SINGLEFILE || t == MOD_LITEMOD)
{ {
QLOG_DEBUG() << "Copy: " << with.m_file.filePath() << " to " << m_file.filePath(); qDebug() << "Copy: " << with.m_file.filePath() << " to " << m_file.filePath();
success = QFile::copy(with.m_file.filePath(), m_file.filePath()); success = QFile::copy(with.m_file.filePath(), m_file.filePath());
} }
if (t == MOD_FOLDER) if (t == MOD_FOLDER)

View File

@ -21,7 +21,7 @@
#include <QUuid> #include <QUuid>
#include <QString> #include <QString>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include "logger/QsLog.h" #include <QDebug>
ModList::ModList(const QString &dir, const QString &list_file) ModList::ModList(const QString &dir, const QString &list_file)
: QAbstractListModel(), m_dir(dir), m_list_file(list_file) : QAbstractListModel(), m_dir(dir), m_list_file(list_file)
@ -42,11 +42,11 @@ void ModList::startWatching()
is_watching = m_watcher->addPath(m_dir.absolutePath()); is_watching = m_watcher->addPath(m_dir.absolutePath());
if (is_watching) if (is_watching)
{ {
QLOG_INFO() << "Started watching " << m_dir.absolutePath(); qDebug() << "Started watching " << m_dir.absolutePath();
} }
else else
{ {
QLOG_INFO() << "Failed to start watching " << m_dir.absolutePath(); qDebug() << "Failed to start watching " << m_dir.absolutePath();
} }
} }
@ -55,11 +55,11 @@ void ModList::stopWatching()
is_watching = !m_watcher->removePath(m_dir.absolutePath()); is_watching = !m_watcher->removePath(m_dir.absolutePath());
if (!is_watching) if (!is_watching)
{ {
QLOG_INFO() << "Stopped watching " << m_dir.absolutePath(); qDebug() << "Stopped watching " << m_dir.absolutePath();
} }
else else
{ {
QLOG_INFO() << "Failed to stop watching " << m_dir.absolutePath(); qDebug() << "Failed to stop watching " << m_dir.absolutePath();
} }
} }
@ -162,7 +162,7 @@ bool ModList::update()
endResetModel(); endResetModel();
if (orderOrStateChanged && !m_list_file.isEmpty()) if (orderOrStateChanged && !m_list_file.isEmpty())
{ {
QLOG_INFO() << "Mod list " << m_list_file << " changed!"; qDebug() << "Mod list " << m_list_file << " changed!";
saveListFile(); saveListFile();
emit changed(); emit changed();
} }
@ -559,7 +559,7 @@ bool ModList::dropMimeData(const QMimeData *data, Qt::DropAction action, int row
row = rowCount(); row = rowCount();
if (column == -1) if (column == -1)
column = 0; column = 0;
QLOG_INFO() << "Drop row: " << row << " column: " << column; qDebug() << "Drop row: " << row << " column: " << column;
// files dropped from outside? // files dropped from outside?
if (data->hasUrls()) if (data->hasUrls())
@ -575,7 +575,7 @@ bool ModList::dropMimeData(const QMimeData *data, Qt::DropAction action, int row
continue; continue;
QString filename = url.toLocalFile(); QString filename = url.toLocalFile();
installMod(filename, row); installMod(filename, row);
QLOG_INFO() << "installing: " << filename; qDebug() << "installing: " << filename;
// if there is no ordering, re-sort the list // if there is no ordering, re-sort the list
if (m_list_file.isEmpty()) if (m_list_file.isEmpty())
{ {
@ -596,7 +596,7 @@ bool ModList::dropMimeData(const QMimeData *data, Qt::DropAction action, int row
return false; return false;
QString remoteId = list[0]; QString remoteId = list[0];
int remoteIndex = list[1].toInt(); int remoteIndex = list[1].toInt();
QLOG_INFO() << "move: " << sourcestr; qDebug() << "move: " << sourcestr;
// no moving of things between two lists // no moving of things between two lists
if (remoteId != m_list_id) if (remoteId != m_list_id)
return false; return false;

View File

@ -15,7 +15,7 @@
#include <QIcon> #include <QIcon>
#include <pathutils.h> #include <pathutils.h>
#include "logger/QsLog.h" #include <QDebug>
#include "MMCError.h" #include "MMCError.h"
#include "logic/OneSixInstance.h" #include "logic/OneSixInstance.h"

View File

@ -60,14 +60,14 @@ void OneSixUpdate::executeTask()
} }
if (m_inst->providesVersionFile() || !targetVersion->needsUpdate()) if (m_inst->providesVersionFile() || !targetVersion->needsUpdate())
{ {
QLOG_DEBUG() << "Instance either provides a version file or doesn't need an update."; qDebug() << "Instance either provides a version file or doesn't need an update.";
jarlibStart(); jarlibStart();
return; return;
} }
versionUpdateTask = std::dynamic_pointer_cast<MinecraftVersionList>(ENV.getVersionList("net.minecraft"))->createUpdateTask(m_inst->intendedVersionId()); versionUpdateTask = std::dynamic_pointer_cast<MinecraftVersionList>(ENV.getVersionList("net.minecraft"))->createUpdateTask(m_inst->intendedVersionId());
if (!versionUpdateTask) if (!versionUpdateTask)
{ {
QLOG_DEBUG() << "Didn't spawn an update task."; qDebug() << "Didn't spawn an update task.";
jarlibStart(); jarlibStart();
return; return;
} }
@ -173,7 +173,7 @@ void OneSixUpdate::assetsFailed()
void OneSixUpdate::jarlibStart() void OneSixUpdate::jarlibStart()
{ {
setStatus(tr("Getting the library files from Mojang...")); setStatus(tr("Getting the library files from Mojang..."));
QLOG_INFO() << m_inst->name() << ": downloading libraries"; qDebug() << m_inst->name() << ": downloading libraries";
OneSixInstance *inst = (OneSixInstance *)m_inst; OneSixInstance *inst = (OneSixInstance *)m_inst;
try try
{ {

View File

@ -20,7 +20,7 @@
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QVariant> #include <QVariant>
#include <logger/QsLog.h> #include <QDebug>
#include "AssetsUtils.h" #include "AssetsUtils.h"
#include <pathutils.h> #include <pathutils.h>
@ -85,7 +85,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index)
// TODO: We should probably report this error to the user. // TODO: We should probably report this error to the user.
if (!file.open(QIODevice::ReadOnly)) if (!file.open(QIODevice::ReadOnly))
{ {
QLOG_ERROR() << "Failed to read assets index file" << path; qCritical() << "Failed to read assets index file" << path;
return false; return false;
} }
@ -99,7 +99,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index)
// Fail if the JSON is invalid. // Fail if the JSON is invalid.
if (parseError.error != QJsonParseError::NoError) if (parseError.error != QJsonParseError::NoError)
{ {
QLOG_ERROR() << "Failed to parse assets index file:" << parseError.errorString() qCritical() << "Failed to parse assets index file:" << parseError.errorString()
<< "at offset " << QString::number(parseError.offset); << "at offset " << QString::number(parseError.offset);
return false; return false;
} }
@ -107,7 +107,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index)
// Make sure the root is an object. // Make sure the root is an object.
if (!jsonDoc.isObject()) if (!jsonDoc.isObject())
{ {
QLOG_ERROR() << "Invalid assets index JSON: Root should be an array."; qCritical() << "Invalid assets index JSON: Root should be an array.";
return false; return false;
} }
@ -124,7 +124,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index)
for (QVariantMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) for (QVariantMap::const_iterator iter = map.begin(); iter != map.end(); ++iter)
{ {
// QLOG_DEBUG() << iter.key(); // qDebug() << iter.key();
QVariant variant = iter.value(); QVariant variant = iter.value();
QVariantMap nested_objects = variant.toMap(); QVariantMap nested_objects = variant.toMap();
@ -134,7 +134,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index)
for (QVariantMap::const_iterator nested_iter = nested_objects.begin(); for (QVariantMap::const_iterator nested_iter = nested_objects.begin();
nested_iter != nested_objects.end(); ++nested_iter) nested_iter != nested_objects.end(); ++nested_iter)
{ {
// QLOG_DEBUG() << nested_iter.key() << nested_iter.value().toString(); // qDebug() << nested_iter.key() << nested_iter.value().toString();
QString key = nested_iter.key(); QString key = nested_iter.key();
QVariant value = nested_iter.value(); QVariant value = nested_iter.value();
@ -167,11 +167,11 @@ QDir reconstructAssets(QString assetsId)
if (!indexFile.exists()) if (!indexFile.exists())
{ {
QLOG_ERROR() << "No assets index file" << indexPath << "; can't reconstruct assets"; qCritical() << "No assets index file" << indexPath << "; can't reconstruct assets";
return virtualRoot; return virtualRoot;
} }
QLOG_DEBUG() << "reconstructAssets" << assetsDir.path() << indexDir.path() qDebug() << "reconstructAssets" << assetsDir.path() << indexDir.path()
<< objectDir.path() << virtualDir.path() << virtualRoot.path(); << objectDir.path() << virtualDir.path() << virtualRoot.path();
AssetsIndex index; AssetsIndex index;
@ -179,7 +179,7 @@ QDir reconstructAssets(QString assetsId)
if (loadAssetsIndex && index.isVirtual) if (loadAssetsIndex && index.isVirtual)
{ {
QLOG_INFO() << "Reconstructing virtual assets folder at" << virtualRoot.path(); qDebug() << "Reconstructing virtual assets folder at" << virtualRoot.path();
for (QString map : index.objects.keys()) for (QString map : index.objects.keys())
{ {
@ -198,12 +198,12 @@ QDir reconstructAssets(QString assetsId)
{ {
QFileInfo info(target_path); QFileInfo info(target_path);
QDir target_dir = info.dir(); QDir target_dir = info.dir();
// QLOG_DEBUG() << target_dir; // qDebug() << target_dir;
if (!target_dir.exists()) if (!target_dir.exists())
QDir("").mkpath(target_dir.path()); QDir("").mkpath(target_dir.path());
bool couldCopy = original.copy(target_path); bool couldCopy = original.copy(target_path);
QLOG_DEBUG() << " Copying" << original_path << "to" << target_path qDebug() << " Copying" << original_path << "to" << target_path
<< QString::number(couldCopy); // << original.errorString(); << QString::number(couldCopy); // << original.errorString();
} }
} }

View File

@ -26,14 +26,14 @@
#include <QStringList> #include <QStringList>
#include <QJsonDocument> #include <QJsonDocument>
#include <logger/QsLog.h> #include <QDebug>
MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object) MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object)
{ {
// The JSON object must at least have a username for it to be valid. // The JSON object must at least have a username for it to be valid.
if (!object.value("username").isString()) if (!object.value("username").isString())
{ {
QLOG_ERROR() << "Can't load Mojang account info from JSON object. Username field is " qCritical() << "Can't load Mojang account info from JSON object. Username field is "
"missing or of the wrong type."; "missing or of the wrong type.";
return nullptr; return nullptr;
} }
@ -45,7 +45,7 @@ MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object)
QJsonArray profileArray = object.value("profiles").toArray(); QJsonArray profileArray = object.value("profiles").toArray();
if (profileArray.size() < 1) if (profileArray.size() < 1)
{ {
QLOG_ERROR() << "Can't load Mojang account with username \"" << username qCritical() << "Can't load Mojang account with username \"" << username
<< "\". No profiles found."; << "\". No profiles found.";
return nullptr; return nullptr;
} }
@ -59,7 +59,7 @@ MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object)
bool legacy = profileObject.value("legacy").toBool(false); bool legacy = profileObject.value("legacy").toBool(false);
if (id.isEmpty() || name.isEmpty()) if (id.isEmpty() || name.isEmpty())
{ {
QLOG_WARN() << "Unable to load a profile because it was missing an ID or a name."; qWarning() << "Unable to load a profile because it was missing an ID or a name.";
continue; continue;
} }
profiles.append({id, name, legacy}); profiles.append({id, name, legacy});

View File

@ -24,7 +24,7 @@
#include <QJsonParseError> #include <QJsonParseError>
#include <QDir> #include <QDir>
#include "logger/QsLog.h" #include <QDebug>
#include "logic/auth/MojangAccount.h" #include "logic/auth/MojangAccount.h"
#include <pathutils.h> #include <pathutils.h>
@ -262,7 +262,7 @@ bool MojangAccountList::loadList(const QString &filePath)
path = m_listFilePath; path = m_listFilePath;
if (path.isEmpty()) if (path.isEmpty())
{ {
QLOG_ERROR() << "Can't load Mojang account list. No file path given and no default set."; qCritical() << "Can't load Mojang account list. No file path given and no default set.";
return false; return false;
} }
@ -272,7 +272,7 @@ bool MojangAccountList::loadList(const QString &filePath)
// TODO: We should probably report this error to the user. // TODO: We should probably report this error to the user.
if (!file.open(QIODevice::ReadOnly)) if (!file.open(QIODevice::ReadOnly))
{ {
QLOG_ERROR() << QString("Failed to read the account list file (%1).").arg(path).toUtf8(); qCritical() << QString("Failed to read the account list file (%1).").arg(path).toUtf8();
return false; return false;
} }
@ -286,7 +286,7 @@ bool MojangAccountList::loadList(const QString &filePath)
// Fail if the JSON is invalid. // Fail if the JSON is invalid.
if (parseError.error != QJsonParseError::NoError) if (parseError.error != QJsonParseError::NoError)
{ {
QLOG_ERROR() << QString("Failed to parse account list file: %1 at offset %2") qCritical() << QString("Failed to parse account list file: %1 at offset %2")
.arg(parseError.errorString(), QString::number(parseError.offset)) .arg(parseError.errorString(), QString::number(parseError.offset))
.toUtf8(); .toUtf8();
return false; return false;
@ -295,7 +295,7 @@ bool MojangAccountList::loadList(const QString &filePath)
// Make sure the root is an object. // Make sure the root is an object.
if (!jsonDoc.isObject()) if (!jsonDoc.isObject())
{ {
QLOG_ERROR() << "Invalid account list JSON: Root should be an array."; qCritical() << "Invalid account list JSON: Root should be an array.";
return false; return false;
} }
@ -305,7 +305,7 @@ bool MojangAccountList::loadList(const QString &filePath)
if (root.value("formatVersion").toVariant().toInt() != ACCOUNT_LIST_FORMAT_VERSION) if (root.value("formatVersion").toVariant().toInt() != ACCOUNT_LIST_FORMAT_VERSION)
{ {
QString newName = "accounts-old.json"; QString newName = "accounts-old.json";
QLOG_WARN() << "Format version mismatch when loading account list. Existing one will be renamed to" qWarning() << "Format version mismatch when loading account list. Existing one will be renamed to"
<< newName; << newName;
// Attempt to rename the old version. // Attempt to rename the old version.
@ -327,7 +327,7 @@ bool MojangAccountList::loadList(const QString &filePath)
} }
else else
{ {
QLOG_WARN() << "Failed to load an account."; qWarning() << "Failed to load an account.";
} }
} }
// Load the active account. // Load the active account.
@ -343,7 +343,7 @@ bool MojangAccountList::saveList(const QString &filePath)
path = m_listFilePath; path = m_listFilePath;
if (path.isEmpty()) if (path.isEmpty())
{ {
QLOG_ERROR() << "Can't save Mojang account list. No file path given and no default set."; qCritical() << "Can't save Mojang account list. No file path given and no default set.";
return false; return false;
} }
@ -359,16 +359,16 @@ bool MojangAccountList::saveList(const QString &filePath)
badDir.removeRecursively(); badDir.removeRecursively();
} }
QLOG_INFO() << "Writing account list to" << path; qDebug() << "Writing account list to" << path;
QLOG_DEBUG() << "Building JSON data structure."; qDebug() << "Building JSON data structure.";
// Build the JSON document to write to the list file. // Build the JSON document to write to the list file.
QJsonObject root; QJsonObject root;
root.insert("formatVersion", ACCOUNT_LIST_FORMAT_VERSION); root.insert("formatVersion", ACCOUNT_LIST_FORMAT_VERSION);
// Build a list of accounts. // Build a list of accounts.
QLOG_DEBUG() << "Building account array."; qDebug() << "Building account array.";
QJsonArray accounts; QJsonArray accounts;
for (MojangAccountPtr account : m_accounts) for (MojangAccountPtr account : m_accounts)
{ {
@ -389,14 +389,14 @@ bool MojangAccountList::saveList(const QString &filePath)
QJsonDocument doc(root); QJsonDocument doc(root);
// Now that we're done building the JSON object, we can write it to the file. // Now that we're done building the JSON object, we can write it to the file.
QLOG_DEBUG() << "Writing account list to file."; qDebug() << "Writing account list to file.";
QFile file(path); QFile file(path);
// Try to open the file and fail if we can't. // Try to open the file and fail if we can't.
// TODO: We should probably report this error to the user. // TODO: We should probably report this error to the user.
if (!file.open(QIODevice::WriteOnly)) if (!file.open(QIODevice::WriteOnly))
{ {
QLOG_ERROR() << QString("Failed to read the account list file (%1).").arg(path).toUtf8(); qCritical() << QString("Failed to read the account list file (%1).").arg(path).toUtf8();
return false; return false;
} }
@ -405,7 +405,7 @@ bool MojangAccountList::saveList(const QString &filePath)
file.setPermissions(QFile::ReadOwner|QFile::WriteOwner|QFile::ReadUser|QFile::WriteUser); file.setPermissions(QFile::ReadOwner|QFile::WriteOwner|QFile::ReadUser|QFile::WriteUser);
file.close(); file.close();
QLOG_INFO() << "Saved account list to" << path; qDebug() << "Saved account list to" << path;
return true; return true;
} }

View File

@ -26,7 +26,7 @@
#include <logic/auth/MojangAccount.h> #include <logic/auth/MojangAccount.h>
#include <logic/net/URLConstants.h> #include <logic/net/URLConstants.h>
#include "logger/QsLog.h" #include <QDebug>
YggdrasilTask::YggdrasilTask(MojangAccount *account, QObject *parent) YggdrasilTask::YggdrasilTask(MojangAccount *account, QObject *parent)
: Task(parent), m_account(account) : Task(parent), m_account(account)
@ -94,9 +94,9 @@ void YggdrasilTask::sslErrors(QList<QSslError> errors)
int i = 1; int i = 1;
for (auto error : errors) for (auto error : errors)
{ {
QLOG_ERROR() << "LOGIN SSL Error #" << i << " : " << error.errorString(); qCritical() << "LOGIN SSL Error #" << i << " : " << error.errorString();
auto cert = error.certificate(); auto cert = error.certificate();
QLOG_ERROR() << "Certificate in question:\n" << cert.toText(); qCritical() << "Certificate in question:\n" << cert.toText();
i++; i++;
} }
} }
@ -163,7 +163,7 @@ void YggdrasilTask::processReply()
"JSON response: %1 at offset %2.") "JSON response: %1 at offset %2.")
.arg(jsonError.errorString()) .arg(jsonError.errorString())
.arg(jsonError.offset)); .arg(jsonError.offset));
QLOG_ERROR() << replyData; qCritical() << replyData;
} }
return; return;
} }
@ -177,7 +177,7 @@ void YggdrasilTask::processReply()
// We were able to parse the server's response. Woo! // We were able to parse the server's response. Woo!
// Call processError. If a subclass has overridden it then they'll handle their // Call processError. If a subclass has overridden it then they'll handle their
// stuff there. // stuff there.
QLOG_DEBUG() << "The request failed, but the server gave us an error message. " qDebug() << "The request failed, but the server gave us an error message. "
"Processing error."; "Processing error.";
processError(doc.object()); processError(doc.object());
} }
@ -185,7 +185,7 @@ void YggdrasilTask::processReply()
{ {
// The server didn't say anything regarding the error. Give the user an unknown // The server didn't say anything regarding the error. Give the user an unknown
// error. // error.
QLOG_DEBUG() qDebug()
<< "The request failed and the server gave no error message. Unknown error."; << "The request failed and the server gave no error message. Unknown error.";
changeState(STATE_FAILED_SOFT, changeState(STATE_FAILED_SOFT,
tr("An unknown error occurred when trying to communicate with the " tr("An unknown error occurred when trying to communicate with the "

View File

@ -23,7 +23,7 @@
#include <QJsonArray> #include <QJsonArray>
#include <QVariant> #include <QVariant>
#include "logger/QsLog.h" #include <QDebug>
AuthenticateTask::AuthenticateTask(MojangAccount * account, const QString &password, AuthenticateTask::AuthenticateTask(MojangAccount * account, const QString &password,
QObject *parent) QObject *parent)
@ -74,11 +74,11 @@ void AuthenticateTask::processResponse(QJsonObject responseData)
{ {
// Read the response data. We need to get the client token, access token, and the selected // Read the response data. We need to get the client token, access token, and the selected
// profile. // profile.
QLOG_DEBUG() << "Processing authentication response."; qDebug() << "Processing authentication response.";
// QLOG_DEBUG() << responseData; // qDebug() << responseData;
// If we already have a client token, make sure the one the server gave us matches our // If we already have a client token, make sure the one the server gave us matches our
// existing one. // existing one.
QLOG_DEBUG() << "Getting client token."; qDebug() << "Getting client token.";
QString clientToken = responseData.value("clientToken").toString(""); QString clientToken = responseData.value("clientToken").toString("");
if (clientToken.isEmpty()) if (clientToken.isEmpty())
{ {
@ -95,7 +95,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData)
m_account->m_clientToken = clientToken; m_account->m_clientToken = clientToken;
// Now, we set the access token. // Now, we set the access token.
QLOG_DEBUG() << "Getting access token."; qDebug() << "Getting access token.";
QString accessToken = responseData.value("accessToken").toString(""); QString accessToken = responseData.value("accessToken").toString("");
if (accessToken.isEmpty()) if (accessToken.isEmpty())
{ {
@ -110,7 +110,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData)
// Mojang hasn't yet implemented the profile system, // Mojang hasn't yet implemented the profile system,
// but we might as well support what's there so we // but we might as well support what's there so we
// don't have trouble implementing it later. // don't have trouble implementing it later.
QLOG_DEBUG() << "Loading profile list."; qDebug() << "Loading profile list.";
QJsonArray availableProfiles = responseData.value("availableProfiles").toArray(); QJsonArray availableProfiles = responseData.value("availableProfiles").toArray();
QList<AccountProfile> loadedProfiles; QList<AccountProfile> loadedProfiles;
for (auto iter : availableProfiles) for (auto iter : availableProfiles)
@ -126,7 +126,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData)
// This should never happen, but we might as well // This should never happen, but we might as well
// warn about it if it does so we can debug it easily. // warn about it if it does so we can debug it easily.
// You never know when Mojang might do something truly derpy. // You never know when Mojang might do something truly derpy.
QLOG_WARN() << "Found entry in available profiles list with missing ID or name " qWarning() << "Found entry in available profiles list with missing ID or name "
"field. Ignoring it."; "field. Ignoring it.";
} }
@ -140,7 +140,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData)
// We do need to make sure that the current profile that the server gave us // We do need to make sure that the current profile that the server gave us
// is actually in the available profiles list. // is actually in the available profiles list.
// If it isn't, we'll just fail horribly (*shouldn't* ever happen, but you never know). // If it isn't, we'll just fail horribly (*shouldn't* ever happen, but you never know).
QLOG_DEBUG() << "Setting current profile."; qDebug() << "Setting current profile.";
QJsonObject currentProfile = responseData.value("selectedProfile").toObject(); QJsonObject currentProfile = responseData.value("selectedProfile").toObject();
QString currentProfileId = currentProfile.value("id").toString(""); QString currentProfileId = currentProfile.value("id").toString("");
if (currentProfileId.isEmpty()) if (currentProfileId.isEmpty())
@ -173,7 +173,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData)
// We've made it through the minefield of possible errors. Return true to indicate that // We've made it through the minefield of possible errors. Return true to indicate that
// we've succeeded. // we've succeeded.
QLOG_DEBUG() << "Finished reading authentication response."; qDebug() << "Finished reading authentication response.";
changeState(STATE_SUCCEEDED); changeState(STATE_SUCCEEDED);
} }

View File

@ -22,7 +22,7 @@
#include <QJsonArray> #include <QJsonArray>
#include <QVariant> #include <QVariant>
#include "logger/QsLog.h" #include <QDebug>
RefreshTask::RefreshTask(MojangAccount *account) : YggdrasilTask(account) RefreshTask::RefreshTask(MojangAccount *account) : YggdrasilTask(account)
{ {
@ -63,9 +63,9 @@ void RefreshTask::processResponse(QJsonObject responseData)
{ {
// Read the response data. We need to get the client token, access token, and the selected // Read the response data. We need to get the client token, access token, and the selected
// profile. // profile.
QLOG_DEBUG() << "Processing authentication response."; qDebug() << "Processing authentication response.";
// QLOG_DEBUG() << responseData; // qDebug() << responseData;
// If we already have a client token, make sure the one the server gave us matches our // If we already have a client token, make sure the one the server gave us matches our
// existing one. // existing one.
QString clientToken = responseData.value("clientToken").toString(""); QString clientToken = responseData.value("clientToken").toString("");
@ -82,7 +82,7 @@ void RefreshTask::processResponse(QJsonObject responseData)
} }
// Now, we set the access token. // Now, we set the access token.
QLOG_DEBUG() << "Getting new access token."; qDebug() << "Getting new access token.";
QString accessToken = responseData.value("accessToken").toString(""); QString accessToken = responseData.value("accessToken").toString("");
if (accessToken.isEmpty()) if (accessToken.isEmpty())
{ {
@ -120,7 +120,7 @@ void RefreshTask::processResponse(QJsonObject responseData)
// We've made it through the minefield of possible errors. Return true to indicate that // We've made it through the minefield of possible errors. Return true to indicate that
// we've succeeded. // we've succeeded.
QLOG_DEBUG() << "Finished reading refresh response."; qDebug() << "Finished reading refresh response.";
// Reset the access token. // Reset the access token.
m_account->m_accessToken = accessToken; m_account->m_accessToken = accessToken;
changeState(STATE_SUCCEEDED); changeState(STATE_SUCCEEDED);

View File

@ -23,7 +23,7 @@
#include <QJsonArray> #include <QJsonArray>
#include <QVariant> #include <QVariant>
#include "logger/QsLog.h" #include <QDebug>
ValidateTask::ValidateTask(MojangAccount * account, QObject *parent) ValidateTask::ValidateTask(MojangAccount * account, QObject *parent)
: YggdrasilTask(account, parent) : YggdrasilTask(account, parent)

View File

@ -181,7 +181,7 @@ bool ForgeInstaller::add(OneSixInstance *to)
// mark bad libraries based on the xzlist above // mark bad libraries based on the xzlist above
for (auto entry : xzlist) for (auto entry : xzlist)
{ {
QLOG_DEBUG() << "Testing " << rawName << " : " << entry; qDebug() << "Testing " << rawName << " : " << entry;
if (rawName.startsWith(entry)) if (rawName.startsWith(entry))
{ {
lib->setHint("forge-pack-xz"); lib->setHint("forge-pack-xz");
@ -260,7 +260,7 @@ bool ForgeInstaller::add(OneSixInstance *to)
QFile file(filename(to->instanceRoot())); QFile file(filename(to->instanceRoot()));
if (!file.open(QFile::WriteOnly)) if (!file.open(QFile::WriteOnly))
{ {
QLOG_ERROR() << "Error opening" << file.fileName() qCritical() << "Error opening" << file.fileName()
<< "for reading:" << file.errorString(); << "for reading:" << file.errorString();
return false; return false;
} }
@ -314,7 +314,7 @@ bool ForgeInstaller::addLegacy(OneSixInstance *to)
QFile file(filename(to->instanceRoot())); QFile file(filename(to->instanceRoot()));
if (!file.open(QFile::WriteOnly)) if (!file.open(QFile::WriteOnly))
{ {
QLOG_ERROR() << "Error opening" << file.fileName() qCritical() << "Error opening" << file.fileName()
<< "for reading:" << file.errorString(); << "for reading:" << file.errorString();
return false; return false;
} }
@ -352,7 +352,7 @@ protected:
{ {
if (!install(entry, forgeVersion)) if (!install(entry, forgeVersion))
{ {
QLOG_ERROR() << "Failure installing forge"; qCritical() << "Failure installing forge";
emitFailed(tr("Failure to install forge")); emitFailed(tr("Failure to install forge"));
} }
else else

View File

@ -1,6 +1,6 @@
#include "logic/Env.h" #include "logic/Env.h"
#include "ForgeMirrors.h" #include "ForgeMirrors.h"
#include "logger/QsLog.h" #include <QDebug>
#include <algorithm> #include <algorithm>
#include <random> #include <random>
@ -15,7 +15,7 @@ ForgeMirrors::ForgeMirrors(QList<ForgeXzDownloadPtr> &libs, NetJobPtr parent_job
void ForgeMirrors::start() void ForgeMirrors::start()
{ {
QLOG_INFO() << "Downloading " << m_url.toString(); qDebug() << "Downloading " << m_url.toString();
QNetworkRequest request(m_url); QNetworkRequest request(m_url);
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)");
auto worker = ENV.qnam(); auto worker = ENV.qnam();
@ -33,7 +33,7 @@ void ForgeMirrors::start()
void ForgeMirrors::downloadError(QNetworkReply::NetworkError error) void ForgeMirrors::downloadError(QNetworkReply::NetworkError error)
{ {
// error happened during download. // error happened during download.
QLOG_ERROR() << "Error getting URL:" << m_url.toString().toLocal8Bit() qCritical() << "Error getting URL:" << m_url.toString().toLocal8Bit()
<< "Network error: " << error; << "Network error: " << error;
m_status = Job_Failed; m_status = Job_Failed;
} }

View File

@ -23,7 +23,7 @@
#include <QtXml> #include <QtXml>
#include <QRegExp> #include <QRegExp>
#include "logger/QsLog.h" #include <QDebug>
ForgeVersionList::ForgeVersionList(QObject *parent) : BaseVersionList(parent) ForgeVersionList::ForgeVersionList(QObject *parent) : BaseVersionList(parent)
{ {
@ -338,7 +338,7 @@ bool ForgeListLoadTask::parseForgeGradleList(QList<BaseVersionPtr> &out)
fVersion->m_buildnr = number.value("build").toDouble(); fVersion->m_buildnr = number.value("build").toDouble();
if(fVersion->m_buildnr >= 953 && fVersion->m_buildnr <= 965) if(fVersion->m_buildnr >= 953 && fVersion->m_buildnr <= 965)
{ {
QLOG_DEBUG() << fVersion->m_buildnr; qDebug() << fVersion->m_buildnr;
} }
fVersion->jobbuildver = number.value("version").toString(); fVersion->jobbuildver = number.value("version").toString();
fVersion->branch = number.value("branch").toString(""); fVersion->branch = number.value("branch").toString("");
@ -437,11 +437,11 @@ void ForgeListLoadTask::listFailed()
auto reply = listDownload->m_reply; auto reply = listDownload->m_reply;
if (reply) if (reply)
{ {
QLOG_ERROR() << "Getting forge version list failed: " << reply->errorString(); qCritical() << "Getting forge version list failed: " << reply->errorString();
} }
else else
{ {
QLOG_ERROR() << "Getting forge version list failed for reasons unknown."; qCritical() << "Getting forge version list failed for reasons unknown.";
} }
} }
@ -450,10 +450,10 @@ void ForgeListLoadTask::gradleListFailed()
auto reply = gradleListDownload->m_reply; auto reply = gradleListDownload->m_reply;
if (reply) if (reply)
{ {
QLOG_ERROR() << "Getting forge version list failed: " << reply->errorString(); qCritical() << "Getting forge version list failed: " << reply->errorString();
} }
else else
{ {
QLOG_ERROR() << "Getting forge version list failed for reasons unknown."; qCritical() << "Getting forge version list failed for reasons unknown.";
} }
} }

View File

@ -21,7 +21,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
#include "logger/QsLog.h" #include <QDebug>
ForgeXzDownload::ForgeXzDownload(QString relative_path, MetaEntryPtr entry) : NetAction() ForgeXzDownload::ForgeXzDownload(QString relative_path, MetaEntryPtr entry) : NetAction()
{ {
@ -62,7 +62,7 @@ void ForgeXzDownload::start()
return; return;
} }
QLOG_INFO() << "Downloading " << m_url.toString(); qDebug() << "Downloading " << m_url.toString();
QNetworkRequest request(m_url); QNetworkRequest request(m_url);
request.setRawHeader(QString("If-None-Match").toLatin1(), m_entry->etag.toLatin1()); request.setRawHeader(QString("If-None-Match").toLatin1(), m_entry->etag.toLatin1());
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Cached)"); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Cached)");
@ -108,10 +108,10 @@ void ForgeXzDownload::failAndTryNextMirror()
void ForgeXzDownload::updateUrl() void ForgeXzDownload::updateUrl()
{ {
QLOG_INFO() << "Updating URL for " << m_url_path; qDebug() << "Updating URL for " << m_url_path;
for (auto possible : m_mirrors) for (auto possible : m_mirrors)
{ {
QLOG_INFO() << "Possible: " << possible.name << " : " << possible.mirror_url; qDebug() << "Possible: " << possible.name << " : " << possible.mirror_url;
} }
QString aggregate = m_mirrors[m_mirror_index].mirror_url + m_url_path + ".pack.xz"; QString aggregate = m_mirrors[m_mirror_index].mirror_url + m_url_path + ".pack.xz";
m_url = QUrl(aggregate); m_url = QUrl(aggregate);
@ -121,10 +121,10 @@ void ForgeXzDownload::downloadFinished()
{ {
//TEST: defer to other possible mirrors (autofail the first one) //TEST: defer to other possible mirrors (autofail the first one)
/* /*
QLOG_INFO() <<"dl " << index_within_job << " mirror " << m_mirror_index; qDebug() <<"dl " << index_within_job << " mirror " << m_mirror_index;
if( m_mirror_index == 0) if( m_mirror_index == 0)
{ {
QLOG_INFO() <<"dl " << index_within_job << " AUTOFAIL"; qDebug() <<"dl " << index_within_job << " AUTOFAIL";
m_status = Job_Failed; m_status = Job_Failed;
m_pack200_xz_file.close(); m_pack200_xz_file.close();
m_pack200_xz_file.remove(); m_pack200_xz_file.remove();
@ -270,38 +270,38 @@ void ForgeXzDownload::decompressAndInstall()
break; break;
case XZ_MEM_ERROR: case XZ_MEM_ERROR:
QLOG_ERROR() << "Memory allocation failed\n"; qCritical() << "Memory allocation failed\n";
xz_dec_end(s); xz_dec_end(s);
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
case XZ_MEMLIMIT_ERROR: case XZ_MEMLIMIT_ERROR:
QLOG_ERROR() << "Memory usage limit reached\n"; qCritical() << "Memory usage limit reached\n";
xz_dec_end(s); xz_dec_end(s);
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
case XZ_FORMAT_ERROR: case XZ_FORMAT_ERROR:
QLOG_ERROR() << "Not a .xz file\n"; qCritical() << "Not a .xz file\n";
xz_dec_end(s); xz_dec_end(s);
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
case XZ_OPTIONS_ERROR: case XZ_OPTIONS_ERROR:
QLOG_ERROR() << "Unsupported options in the .xz headers\n"; qCritical() << "Unsupported options in the .xz headers\n";
xz_dec_end(s); xz_dec_end(s);
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
case XZ_DATA_ERROR: case XZ_DATA_ERROR:
case XZ_BUF_ERROR: case XZ_BUF_ERROR:
QLOG_ERROR() << "File is corrupt\n"; qCritical() << "File is corrupt\n";
xz_dec_end(s); xz_dec_end(s);
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
default: default:
QLOG_ERROR() << "Bug!\n"; qCritical() << "Bug!\n";
xz_dec_end(s); xz_dec_end(s);
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
@ -316,35 +316,35 @@ void ForgeXzDownload::decompressAndInstall()
// FIXME: dispose of file handles, pointers and the like. Ideally wrap in objects. // FIXME: dispose of file handles, pointers and the like. Ideally wrap in objects.
if(handle_in == -1) if(handle_in == -1)
{ {
QLOG_ERROR() << "Error reopening " << pack200_file.fileName(); qCritical() << "Error reopening " << pack200_file.fileName();
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
} }
FILE * file_in = fdopen(handle_in,"r"); FILE * file_in = fdopen(handle_in,"r");
if(!file_in) if(!file_in)
{ {
QLOG_ERROR() << "Error reopening " << pack200_file.fileName(); qCritical() << "Error reopening " << pack200_file.fileName();
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
} }
QFile qfile_out(m_target_path); QFile qfile_out(m_target_path);
if(!qfile_out.open(QIODevice::WriteOnly)) if(!qfile_out.open(QIODevice::WriteOnly))
{ {
QLOG_ERROR() << "Error opening " << qfile_out.fileName(); qCritical() << "Error opening " << qfile_out.fileName();
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
} }
int handle_out = qfile_out.handle(); int handle_out = qfile_out.handle();
if(handle_out == -1) if(handle_out == -1)
{ {
QLOG_ERROR() << "Error opening " << qfile_out.fileName(); qCritical() << "Error opening " << qfile_out.fileName();
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
} }
FILE * file_out = fdopen(handle_out,"w"); FILE * file_out = fdopen(handle_out,"w");
if(!file_out) if(!file_out)
{ {
QLOG_ERROR() << "Error opening " << qfile_out.fileName(); qCritical() << "Error opening " << qfile_out.fileName();
failAndTryNextMirror(); failAndTryNextMirror();
return; return;
} }
@ -355,7 +355,7 @@ void ForgeXzDownload::decompressAndInstall()
catch (std::runtime_error &err) catch (std::runtime_error &err)
{ {
m_status = Job_Failed; m_status = Job_Failed;
QLOG_ERROR() << "Error unpacking " << pack200_file.fileName() << " : " << err.what(); qCritical() << "Error unpacking " << pack200_file.fileName() << " : " << err.what();
QFile f(m_target_path); QFile f(m_target_path);
if (f.exists()) if (f.exists())
f.remove(); f.remove();

View File

@ -106,10 +106,10 @@ void FTBProfileStrategy::loadUserPatches()
QFileInfo finfo(filename); QFileInfo finfo(filename);
if(!finfo.exists()) if(!finfo.exists())
{ {
QLOG_INFO() << "Patch file " << filename << " was deleted by external means..."; qDebug() << "Patch file " << filename << " was deleted by external means...";
continue; continue;
} }
QLOG_INFO() << "Reading" << filename << "by user order"; qDebug() << "Reading" << filename << "by user order";
auto file = ProfileUtils::parseJsonFile(finfo, false); auto file = ProfileUtils::parseJsonFile(finfo, false);
// sanity check. prevent tampering with files. // sanity check. prevent tampering with files.
if (file->fileId != id) if (file->fileId != id)
@ -124,7 +124,7 @@ void FTBProfileStrategy::loadUserPatches()
for (auto info : patches.entryInfoList(QStringList() << "*.json", QDir::Files)) for (auto info : patches.entryInfoList(QStringList() << "*.json", QDir::Files))
{ {
// parse the file // parse the file
QLOG_INFO() << "Reading" << info.fileName(); qDebug() << "Reading" << info.fileName();
auto file = ProfileUtils::parseJsonFile(info, true); auto file = ProfileUtils::parseJsonFile(info, true);
// ignore builtins // ignore builtins
if (file->fileId == "net.minecraft") if (file->fileId == "net.minecraft")

View File

@ -21,11 +21,11 @@ void OneSixFTBInstance::copy(const QDir &newDir)
QStringList libraryNames; QStringList libraryNames;
// create patch file // create patch file
{ {
QLOG_DEBUG() << "Creating patch file for FTB instance..."; qDebug()<< "Creating patch file for FTB instance...";
QFile f(minecraftRoot() + "/pack.json"); QFile f(minecraftRoot() + "/pack.json");
if (!f.open(QFile::ReadOnly)) if (!f.open(QFile::ReadOnly))
{ {
QLOG_ERROR() << "Couldn't open" << f.fileName() << ":" << f.errorString(); qCritical() << "Couldn't open" << f.fileName() << ":" << f.errorString();
return; return;
} }
QJsonObject root = QJsonDocument::fromJson(f.readAll()).object(); QJsonObject root = QJsonDocument::fromJson(f.readAll()).object();
@ -68,14 +68,14 @@ void OneSixFTBInstance::copy(const QDir &newDir)
QFile out(newDir.absoluteFilePath("patches/ftb.json")); QFile out(newDir.absoluteFilePath("patches/ftb.json"));
if (!out.open(QFile::WriteOnly | QFile::Truncate)) if (!out.open(QFile::WriteOnly | QFile::Truncate))
{ {
QLOG_ERROR() << "Couldn't open" << out.fileName() << ":" << out.errorString(); qCritical() << "Couldn't open" << out.fileName() << ":" << out.errorString();
return; return;
} }
out.write(QJsonDocument(root).toJson()); out.write(QJsonDocument(root).toJson());
} }
// copy libraries // copy libraries
{ {
QLOG_DEBUG() << "Copying FTB libraries"; qDebug() << "Copying FTB libraries";
for (auto library : libraryNames) for (auto library : libraryNames)
{ {
OneSixLibrary *lib = new OneSixLibrary(library); OneSixLibrary *lib = new OneSixLibrary(library);
@ -86,11 +86,11 @@ void OneSixFTBInstance::copy(const QDir &newDir)
} }
if (!ensureFilePathExists(out)) if (!ensureFilePathExists(out))
{ {
QLOG_ERROR() << "Couldn't create folder structure for" << out; qCritical() << "Couldn't create folder structure for" << out;
} }
if (!QFile::copy(librariesPath().absoluteFilePath(lib->storagePath()), out)) if (!QFile::copy(librariesPath().absoluteFilePath(lib->storagePath()), out))
{ {
QLOG_ERROR() << "Couldn't copy" << lib->rawName(); qCritical() << "Couldn't copy" << lib->rawName();
} }
} }
} }

View File

@ -21,7 +21,7 @@
#include <QUrl> #include <QUrl>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QSet> #include <QSet>
#include <logger/QsLog.h> #include <QDebug>
#define MAX_SIZE 1024 #define MAX_SIZE 1024
@ -84,7 +84,7 @@ void IconList::directoryChanged(const QString &path)
for (auto remove : to_remove) for (auto remove : to_remove)
{ {
QLOG_INFO() << "Removing " << remove; qDebug() << "Removing " << remove;
QFileInfo rmfile(remove); QFileInfo rmfile(remove);
QString key = rmfile.baseName(); QString key = rmfile.baseName();
int idx = getIconIndex(key); int idx = getIconIndex(key);
@ -108,7 +108,7 @@ void IconList::directoryChanged(const QString &path)
for (auto add : to_add) for (auto add : to_add)
{ {
QLOG_INFO() << "Adding " << add; qDebug() << "Adding " << add;
QFileInfo addfile(add); QFileInfo addfile(add);
QString key = addfile.baseName(); QString key = addfile.baseName();
if (addIcon(key, QString(), addfile.filePath(), MMCIcon::FileBased)) if (addIcon(key, QString(), addfile.filePath(), MMCIcon::FileBased))
@ -121,7 +121,7 @@ void IconList::directoryChanged(const QString &path)
void IconList::fileChanged(const QString &path) void IconList::fileChanged(const QString &path)
{ {
QLOG_INFO() << "Checking " << path; qDebug() << "Checking " << path;
QFileInfo checkfile(path); QFileInfo checkfile(path);
if (!checkfile.exists()) if (!checkfile.exists())
return; return;
@ -153,11 +153,11 @@ void IconList::startWatching()
is_watching = m_watcher->addPath(abs_path); is_watching = m_watcher->addPath(abs_path);
if (is_watching) if (is_watching)
{ {
QLOG_INFO() << "Started watching " << abs_path; qDebug() << "Started watching " << abs_path;
} }
else else
{ {
QLOG_INFO() << "Failed to start watching " << abs_path; qDebug() << "Failed to start watching " << abs_path;
} }
} }

View File

@ -16,12 +16,12 @@
#include "JavaCheckerJob.h" #include "JavaCheckerJob.h"
#include "pathutils.h" #include "pathutils.h"
#include "logger/QsLog.h" #include <QDebug>
void JavaCheckerJob::partFinished(JavaCheckResult result) void JavaCheckerJob::partFinished(JavaCheckResult result)
{ {
num_finished++; num_finished++;
QLOG_INFO() << m_job_name.toLocal8Bit() << "progress:" << num_finished << "/" qDebug() << m_job_name.toLocal8Bit() << "progress:" << num_finished << "/"
<< javacheckers.size(); << javacheckers.size();
emit progress(num_finished, javacheckers.size()); emit progress(num_finished, javacheckers.size());
@ -35,7 +35,7 @@ void JavaCheckerJob::partFinished(JavaCheckResult result)
void JavaCheckerJob::start() void JavaCheckerJob::start()
{ {
QLOG_INFO() << m_job_name.toLocal8Bit() << " started."; qDebug() << m_job_name.toLocal8Bit() << " started.";
m_running = true; m_running = true;
for (auto iter : javacheckers) for (auto iter : javacheckers)
{ {

View File

@ -21,7 +21,7 @@
#include <logic/settings/Setting.h> #include <logic/settings/Setting.h>
#include <pathutils.h> #include <pathutils.h>
#include "logger/QsLog.h" #include <QDebug>
#include "logic/java/JavaUtils.h" #include "logic/java/JavaUtils.h"
#include "logic/java/JavaCheckerJob.h" #include "logic/java/JavaCheckerJob.h"
#include "logic/java/JavaVersionList.h" #include "logic/java/JavaVersionList.h"
@ -197,7 +197,7 @@ QList<QString> JavaUtils::FindJavaPaths()
#elif LINUX #elif LINUX
QList<QString> JavaUtils::FindJavaPaths() QList<QString> JavaUtils::FindJavaPaths()
{ {
QLOG_INFO() << "Linux Java detection incomplete - defaulting to \"java\""; qDebug() << "Linux Java detection incomplete - defaulting to \"java\"";
QList<QString> javas; QList<QString> javas;
javas.append(this->GetDefaultJava()->path); javas.append(this->GetDefaultJava()->path);
@ -209,7 +209,7 @@ QList<QString> JavaUtils::FindJavaPaths()
#else #else
QList<QString> JavaUtils::FindJavaPaths() QList<QString> JavaUtils::FindJavaPaths()
{ {
QLOG_INFO() << "Unknown operating system build - defaulting to \"java\""; qDebug() << "Unknown operating system build - defaulting to \"java\"";
QList<QString> javas; QList<QString> javas;
javas.append(this->GetDefaultJava()->path); javas.append(this->GetDefaultJava()->path);

View File

@ -17,7 +17,7 @@
#include <QtXml> #include <QtXml>
#include <QRegExp> #include <QRegExp>
#include "logger/QsLog.h" #include <QDebug>
#include "logic/java/JavaVersionList.h" #include "logic/java/JavaVersionList.h"
#include "logic/java/JavaCheckerJob.h" #include "logic/java/JavaCheckerJob.h"
@ -180,11 +180,11 @@ void JavaListLoadTask::executeTask()
connect(m_job.get(), SIGNAL(finished(QList<JavaCheckResult>)), this, SLOT(javaCheckerFinished(QList<JavaCheckResult>))); connect(m_job.get(), SIGNAL(finished(QList<JavaCheckResult>)), this, SLOT(javaCheckerFinished(QList<JavaCheckResult>)));
connect(m_job.get(), SIGNAL(progress(int, int)), this, SLOT(checkerProgress(int, int))); connect(m_job.get(), SIGNAL(progress(int, int)), this, SLOT(checkerProgress(int, int)));
QLOG_DEBUG() << "Probing the following Java paths: "; qDebug() << "Probing the following Java paths: ";
int id = 0; int id = 0;
for(QString candidate : candidate_paths) for(QString candidate : candidate_paths)
{ {
QLOG_DEBUG() << " " << candidate; qDebug() << " " << candidate;
auto candidate_checker = new JavaChecker(); auto candidate_checker = new JavaChecker();
candidate_checker->path = candidate; candidate_checker->path = candidate;
@ -207,7 +207,7 @@ void JavaListLoadTask::javaCheckerFinished(QList<JavaCheckResult> results)
{ {
QList<JavaVersionPtr> candidates; QList<JavaVersionPtr> candidates;
QLOG_DEBUG() << "Found the following valid Java installations:"; qDebug() << "Found the following valid Java installations:";
for(JavaCheckResult result : results) for(JavaCheckResult result : results)
{ {
if(result.valid) if(result.valid)
@ -219,14 +219,14 @@ void JavaListLoadTask::javaCheckerFinished(QList<JavaCheckResult> results)
javaVersion->path = result.path; javaVersion->path = result.path;
candidates.append(javaVersion); candidates.append(javaVersion);
QLOG_DEBUG() << " " << javaVersion->id << javaVersion->arch << javaVersion->path; qDebug() << " " << javaVersion->id << javaVersion->arch << javaVersion->path;
} }
} }
QList<BaseVersionPtr> javas_bvp; QList<BaseVersionPtr> javas_bvp;
for (auto java : candidates) for (auto java : candidates)
{ {
//QLOG_INFO() << java->id << java->arch << " at " << java->path; //qDebug() << java->id << java->arch << " at " << java->path;
BaseVersionPtr bp_java = std::dynamic_pointer_cast<BaseVersion>(java); BaseVersionPtr bp_java = std::dynamic_pointer_cast<BaseVersion>(java);
if (bp_java) if (bp_java)

View File

@ -18,7 +18,7 @@
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
#include "logger/QsLog.h" #include <QDebug>
#include "logic/minecraft/MinecraftProfile.h" #include "logic/minecraft/MinecraftProfile.h"
#include "logic/minecraft/OneSixLibrary.h" #include "logic/minecraft/OneSixLibrary.h"
@ -76,7 +76,7 @@ bool LiteLoaderInstaller::add(OneSixInstance *to)
QFile file(filename(to->instanceRoot())); QFile file(filename(to->instanceRoot()));
if (!file.open(QFile::WriteOnly)) if (!file.open(QFile::WriteOnly))
{ {
QLOG_ERROR() << "Error opening" << file.fileName() qCritical() << "Error opening" << file.fileName()
<< "for reading:" << file.errorString(); << "for reading:" << file.errorString();
return false; return false;
} }

View File

@ -220,7 +220,7 @@ void LLListLoadTask::listDownloaded()
} }
catch (MMCError &e) catch (MMCError &e)
{ {
QLOG_ERROR() << "Couldn't read JSON object:"; qCritical() << "Couldn't read JSON object:";
continue; continue;
} }
} }

View File

@ -214,7 +214,7 @@ QList<std::shared_ptr<OneSixLibrary> > MinecraftProfile::getActiveNormalLibs()
{ {
if (other->rawName() == lib->rawName()) if (other->rawName() == lib->rawName())
{ {
QLOG_WARN() << "Multiple libraries with name" << lib->rawName() << "in library list!"; qWarning() << "Multiple libraries with name" << lib->rawName() << "in library list!";
continue; continue;
} }
} }

View File

@ -129,7 +129,7 @@ void MinecraftVersionList::loadCachedList()
if (!localIndex.open(QIODevice::ReadOnly)) if (!localIndex.open(QIODevice::ReadOnly))
{ {
// FIXME: this is actually a very bad thing! How do we deal with this? // FIXME: this is actually a very bad thing! How do we deal with this?
QLOG_ERROR() << "The minecraft version cache can't be read."; qCritical() << "The minecraft version cache can't be read.";
return; return;
} }
auto data = localIndex.readAll(); auto data = localIndex.readAll();
@ -146,7 +146,7 @@ void MinecraftVersionList::loadCachedList()
catch (MMCError &e) catch (MMCError &e)
{ {
// the cache has gone bad for some reason... flush it. // the cache has gone bad for some reason... flush it.
QLOG_ERROR() << "The minecraft version cache is corrupted. Flushing cache."; qCritical() << "The minecraft version cache is corrupted. Flushing cache.";
localIndex.remove(); localIndex.remove();
return; return;
} }
@ -155,7 +155,7 @@ void MinecraftVersionList::loadCachedList()
void MinecraftVersionList::loadBuiltinList() void MinecraftVersionList::loadBuiltinList()
{ {
QLOG_INFO() << "Loading builtin version list."; qDebug() << "Loading builtin version list.";
// grab the version list data from internal resources. // grab the version list data from internal resources.
const QJsonDocument doc = const QJsonDocument doc =
MMCJson::parseFile(":/versions/minecraft.json", MMCJson::parseFile(":/versions/minecraft.json",
@ -170,13 +170,13 @@ void MinecraftVersionList::loadBuiltinList()
QString versionTypeStr = versionObj.value("type").toString(""); QString versionTypeStr = versionObj.value("type").toString("");
if (versionID.isEmpty() || versionTypeStr.isEmpty()) if (versionID.isEmpty() || versionTypeStr.isEmpty())
{ {
QLOG_ERROR() << "Parsed version is missing ID or type"; qCritical() << "Parsed version is missing ID or type";
continue; continue;
} }
if (g_VersionFilterData.legacyBlacklist.contains(versionID)) if (g_VersionFilterData.legacyBlacklist.contains(versionID))
{ {
QLOG_WARN() << "Blacklisted legacy version ignored: " << versionID; qWarning() << "Blacklisted legacy version ignored: " << versionID;
continue; continue;
} }
@ -188,7 +188,7 @@ void MinecraftVersionList::loadBuiltinList()
if (!parse_timestamp(versionObj.value("releaseTime").toString(""), if (!parse_timestamp(versionObj.value("releaseTime").toString(""),
mcVersion->m_releaseTimeString, mcVersion->m_releaseTime)) mcVersion->m_releaseTimeString, mcVersion->m_releaseTime))
{ {
QLOG_ERROR() << "Error while parsing version" << versionID qCritical() << "Error while parsing version" << versionID
<< ": invalid version timestamp"; << ": invalid version timestamp";
continue; continue;
} }
@ -217,7 +217,7 @@ void MinecraftVersionList::loadBuiltinList()
void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource source) void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource source)
{ {
QLOG_INFO() << "Loading" << ((source == Remote) ? "remote" : "local") << "version list."; qDebug() << "Loading" << ((source == Remote) ? "remote" : "local") << "version list.";
if (!jsonDoc.isObject()) if (!jsonDoc.isObject())
{ {
@ -234,7 +234,7 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
} }
catch (MMCError &err) catch (MMCError &err)
{ {
QLOG_ERROR() qCritical()
<< tr("Error parsing version list JSON: couldn't determine latest versions"); << tr("Error parsing version list JSON: couldn't determine latest versions");
} }
@ -252,7 +252,7 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
// Load the version info. // Load the version info.
if (!version.isObject()) if (!version.isObject())
{ {
QLOG_ERROR() << "Error while parsing version list : invalid JSON structure"; qCritical() << "Error while parsing version list : invalid JSON structure";
continue; continue;
} }
@ -260,13 +260,13 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
QString versionID = versionObj.value("id").toString(""); QString versionID = versionObj.value("id").toString("");
if (versionID.isEmpty()) if (versionID.isEmpty())
{ {
QLOG_ERROR() << "Error while parsing version : version ID is missing"; qCritical() << "Error while parsing version : version ID is missing";
continue; continue;
} }
if (g_VersionFilterData.legacyBlacklist.contains(versionID)) if (g_VersionFilterData.legacyBlacklist.contains(versionID))
{ {
QLOG_WARN() << "Blacklisted legacy version ignored: " << versionID; qWarning() << "Blacklisted legacy version ignored: " << versionID;
continue; continue;
} }
@ -277,14 +277,14 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
if (!parse_timestamp(versionObj.value("releaseTime").toString(""), if (!parse_timestamp(versionObj.value("releaseTime").toString(""),
mcVersion->m_releaseTimeString, mcVersion->m_releaseTime)) mcVersion->m_releaseTimeString, mcVersion->m_releaseTime))
{ {
QLOG_ERROR() << "Error while parsing version" << versionID qCritical() << "Error while parsing version" << versionID
<< ": invalid release timestamp"; << ": invalid release timestamp";
continue; continue;
} }
if (!parse_timestamp(versionObj.value("time").toString(""), if (!parse_timestamp(versionObj.value("time").toString(""),
mcVersion->m_updateTimeString, mcVersion->m_updateTime)) mcVersion->m_updateTimeString, mcVersion->m_updateTime))
{ {
QLOG_ERROR() << "Error while parsing version" << versionID qCritical() << "Error while parsing version" << versionID
<< ": invalid update timestamp"; << ": invalid update timestamp";
continue; continue;
} }
@ -302,7 +302,7 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
QString versionTypeStr = versionObj.value("type").toString(""); QString versionTypeStr = versionObj.value("type").toString("");
if (versionTypeStr.isEmpty()) if (versionTypeStr.isEmpty())
{ {
QLOG_ERROR() << "Ignoring" << versionID qCritical() << "Ignoring" << versionID
<< "because it doesn't have the version type set."; << "because it doesn't have the version type set.";
continue; continue;
} }
@ -321,12 +321,12 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
} }
else else
{ {
QLOG_ERROR() << "Ignoring" << versionID qCritical() << "Ignoring" << versionID
<< "because it has an invalid version type."; << "because it has an invalid version type.";
continue; continue;
} }
mcVersion->m_type = versionTypeStr; mcVersion->m_type = versionTypeStr;
QLOG_INFO() << "Loaded version" << versionID << "from" qDebug() << "Loaded version" << versionID << "from"
<< ((source == Remote) ? "remote" : "local") << "version list."; << ((source == Remote) ? "remote" : "local") << "version list.";
tempList.append(mcVersion); tempList.append(mcVersion);
} }
@ -494,7 +494,7 @@ void MCVListVersionUpdateTask::json_downloaded()
// now dump the file to disk // now dump the file to disk
auto doc = file->toJson(false); auto doc = file->toJson(false);
auto newdata = doc.toBinaryData(); auto newdata = doc.toBinaryData();
QLOG_INFO() << newdata; qDebug() << newdata;
QString targetPath = "versions/" + versionToUpdate + "/" + versionToUpdate + ".dat"; QString targetPath = "versions/" + versionToUpdate + "/" + versionToUpdate + ".dat";
ensureFilePathExists(targetPath); ensureFilePathExists(targetPath);
QSaveFile vfile1(targetPath); QSaveFile vfile1(targetPath);

View File

@ -116,10 +116,10 @@ void OneSixProfileStrategy::loadUserPatches()
QFileInfo finfo(filename); QFileInfo finfo(filename);
if(!finfo.exists()) if(!finfo.exists())
{ {
QLOG_INFO() << "Patch file " << filename << " was deleted by external means..."; qDebug() << "Patch file " << filename << " was deleted by external means...";
continue; continue;
} }
QLOG_INFO() << "Reading" << filename << "by user order"; qDebug() << "Reading" << filename << "by user order";
auto file = ProfileUtils::parseJsonFile(finfo, false); auto file = ProfileUtils::parseJsonFile(finfo, false);
// sanity check. prevent tampering with files. // sanity check. prevent tampering with files.
if (file->fileId != id) if (file->fileId != id)
@ -134,7 +134,7 @@ void OneSixProfileStrategy::loadUserPatches()
for (auto info : patches.entryInfoList(QStringList() << "*.json", QDir::Files)) for (auto info : patches.entryInfoList(QStringList() << "*.json", QDir::Files))
{ {
// parse the file // parse the file
QLOG_INFO() << "Reading" << info.fileName(); qDebug() << "Reading" << info.fileName();
auto file = ProfileUtils::parseJsonFile(info, true); auto file = ProfileUtils::parseJsonFile(info, true);
// ignore builtins // ignore builtins
if (file->fileId == "net.minecraft") if (file->fileId == "net.minecraft")
@ -253,7 +253,7 @@ bool OneSixProfileStrategy::installJarMods(QStringList filepaths)
QFile file(patchFileName); QFile file(patchFileName);
if (!file.open(QFile::WriteOnly)) if (!file.open(QFile::WriteOnly))
{ {
QLOG_ERROR() << "Error opening" << file.fileName() qCritical() << "Error opening" << file.fileName()
<< "for reading:" << file.errorString(); << "for reading:" << file.errorString();
return false; return false;
} }

View File

@ -1,7 +1,7 @@
#include "ProfileUtils.h" #include "ProfileUtils.h"
#include "logic/minecraft/VersionFilterData.h" #include "logic/minecraft/VersionFilterData.h"
#include "logic/MMCJson.h" #include "logic/MMCJson.h"
#include "logger/QsLog.h" #include <QDebug>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonArray> #include <QJsonArray>
@ -26,7 +26,7 @@ bool writeOverrideOrders(QString path, const PatchOrder &order)
QSaveFile orderFile(path); QSaveFile orderFile(path);
if (!orderFile.open(QFile::WriteOnly)) if (!orderFile.open(QFile::WriteOnly))
{ {
QLOG_ERROR() << "Couldn't open" << orderFile.fileName() qCritical() << "Couldn't open" << orderFile.fileName()
<< "for writing:" << orderFile.errorString(); << "for writing:" << orderFile.errorString();
return false; return false;
} }
@ -50,14 +50,14 @@ bool readOverrideOrders(QString path, PatchOrder &order)
QFile orderFile(path); QFile orderFile(path);
if (!orderFile.exists()) if (!orderFile.exists())
{ {
QLOG_WARN() << "Order file doesn't exist. Ignoring."; qWarning() << "Order file doesn't exist. Ignoring.";
return false; return false;
} }
if (!orderFile.open(QFile::ReadOnly)) if (!orderFile.open(QFile::ReadOnly))
{ {
QLOG_ERROR() << "Couldn't open" << orderFile.fileName() qCritical() << "Couldn't open" << orderFile.fileName()
<< " for reading:" << orderFile.errorString(); << " for reading:" << orderFile.errorString();
QLOG_WARN() << "Ignoring overriden order"; qWarning() << "Ignoring overriden order";
return false; return false;
} }
@ -66,8 +66,8 @@ bool readOverrideOrders(QString path, PatchOrder &order)
QJsonDocument doc = QJsonDocument::fromJson(orderFile.readAll(), &error); QJsonDocument doc = QJsonDocument::fromJson(orderFile.readAll(), &error);
if (error.error != QJsonParseError::NoError) if (error.error != QJsonParseError::NoError)
{ {
QLOG_ERROR() << "Couldn't parse" << orderFile.fileName() << ":" << error.errorString(); qCritical() << "Couldn't parse" << orderFile.fileName() << ":" << error.errorString();
QLOG_WARN() << "Ignoring overriden order"; qWarning() << "Ignoring overriden order";
return false; return false;
} }
@ -90,8 +90,8 @@ bool readOverrideOrders(QString path, PatchOrder &order)
} }
catch (JSONValidationError &err) catch (JSONValidationError &err)
{ {
QLOG_ERROR() << "Couldn't parse" << orderFile.fileName() << ": bad file format"; qCritical() << "Couldn't parse" << orderFile.fileName() << ": bad file format";
QLOG_WARN() << "Ignoring overriden order"; qWarning() << "Ignoring overriden order";
order.clear(); order.clear();
return false; return false;
} }

View File

@ -21,7 +21,7 @@ RawLibraryPtr RawLibrary::fromJson(const QJsonObject &libObj, const QString &fil
if (!val.isString()) if (!val.isString())
{ {
QLOG_WARN() << key << "is not a string in" << filename << "(skipping)"; qWarning() << key << "is not a string in" << filename << "(skipping)";
return false; return false;
} }
@ -49,7 +49,7 @@ RawLibraryPtr RawLibrary::fromJson(const QJsonObject &libObj, const QString &fil
{ {
if (!it.value().isString()) if (!it.value().isString())
{ {
QLOG_WARN() << filename << "contains an invalid native (skipping)"; qWarning() << filename << "contains an invalid native (skipping)";
} }
OpSys opSys = OpSys_fromString(it.key()); OpSys opSys = OpSys_fromString(it.key());
if (opSys != Os_Other) if (opSys != Os_Other)
@ -215,7 +215,7 @@ bool RawLibrary::filesExist(const QDir &base) const
for(auto file: libFiles) for(auto file: libFiles)
{ {
QFileInfo info(base, file); QFileInfo info(base, file);
QLOG_WARN() << info.absoluteFilePath() << "doesn't exist"; qWarning() << info.absoluteFilePath() << "doesn't exist";
if (!info.exists()) if (!info.exists())
return false; return false;
} }

View File

@ -38,7 +38,7 @@
#include "logic/OneSixInstance.h" #include "logic/OneSixInstance.h"
#include "logic/MMCJson.h" #include "logic/MMCJson.h"
#include "logger/QsLog.h" #include <QDebug>
VersionBuilder::VersionBuilder() VersionBuilder::VersionBuilder()
{ {

View File

@ -2,7 +2,7 @@
#include <QJsonDocument> #include <QJsonDocument>
#include <modutils.h> #include <modutils.h>
#include "logger/QsLog.h" #include <QDebug>
#include "logic/minecraft/VersionFile.h" #include "logic/minecraft/VersionFile.h"
#include "logic/minecraft/OneSixLibrary.h" #include "logic/minecraft/OneSixLibrary.h"
@ -57,7 +57,7 @@ VersionFilePtr VersionFile::fromJson(const QJsonDocument &doc, const QString &fi
else else
{ {
// FIXME: evaluate if we don't want to throw exceptions here instead // FIXME: evaluate if we don't want to throw exceptions here instead
QLOG_ERROR() << filename << "doesn't contain an order field"; qCritical() << filename << "doesn't contain an order field";
} }
} }
@ -364,7 +364,7 @@ void VersionFile::applyTo(MinecraftProfile *version)
{ {
case RawLibrary::Apply: case RawLibrary::Apply:
{ {
// QLOG_INFO() << "Applying lib " << lib->name; // qDebug() << "Applying lib " << lib->name;
int index = findLibraryByName(version->libraries, addedLibrary->rawName()); int index = findLibraryByName(version->libraries, addedLibrary->rawName());
if (index >= 0) if (index >= 0)
{ {
@ -396,7 +396,7 @@ void VersionFile::applyTo(MinecraftProfile *version)
} }
else else
{ {
QLOG_WARN() << "Couldn't find" << addedLibrary->rawName() << "(skipping)"; qWarning() << "Couldn't find" << addedLibrary->rawName() << "(skipping)";
} }
break; break;
} }
@ -476,7 +476,7 @@ void VersionFile::applyTo(MinecraftProfile *version)
{ {
toReplace = addedLibrary->insertData; toReplace = addedLibrary->insertData;
} }
// QLOG_INFO() << "Replacing lib " << toReplace << " with " << lib->name; // qDebug() << "Replacing lib " << toReplace << " with " << lib->name;
int index = findLibraryByName(version->libraries, toReplace); int index = findLibraryByName(version->libraries, toReplace);
if (index >= 0) if (index >= 0)
{ {
@ -484,7 +484,7 @@ void VersionFile::applyTo(MinecraftProfile *version)
} }
else else
{ {
QLOG_WARN() << "Couldn't find" << toReplace << "(skipping)"; qWarning() << "Couldn't find" << toReplace << "(skipping)";
} }
break; break;
} }
@ -495,12 +495,12 @@ void VersionFile::applyTo(MinecraftProfile *version)
int index = findLibraryByName(version->libraries, lib); int index = findLibraryByName(version->libraries, lib);
if (index >= 0) if (index >= 0)
{ {
// QLOG_INFO() << "Removing lib " << lib; // qDebug() << "Removing lib " << lib;
version->libraries.removeAt(index); version->libraries.removeAt(index);
} }
else else
{ {
QLOG_WARN() << "Couldn't find" << lib << "(skipping)"; qWarning() << "Couldn't find" << lib << "(skipping)";
} }
} }
} }

View File

@ -15,7 +15,7 @@
#include "ByteArrayDownload.h" #include "ByteArrayDownload.h"
#include "logic/Env.h" #include "logic/Env.h"
#include "logger/QsLog.h" #include <QDebug>
ByteArrayDownload::ByteArrayDownload(QUrl url) : NetAction() ByteArrayDownload::ByteArrayDownload(QUrl url) : NetAction()
{ {
@ -25,7 +25,7 @@ ByteArrayDownload::ByteArrayDownload(QUrl url) : NetAction()
void ByteArrayDownload::start() void ByteArrayDownload::start()
{ {
QLOG_INFO() << "Downloading " << m_url.toString(); qDebug() << "Downloading " << m_url.toString();
QNetworkRequest request(m_url); QNetworkRequest request(m_url);
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)");
auto worker = ENV.qnam(); auto worker = ENV.qnam();
@ -50,7 +50,7 @@ void ByteArrayDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal
void ByteArrayDownload::downloadError(QNetworkReply::NetworkError error) void ByteArrayDownload::downloadError(QNetworkReply::NetworkError error)
{ {
// error happened during download. // error happened during download.
QLOG_ERROR() << "Error getting URL:" << m_url.toString().toLocal8Bit() qCritical() << "Error getting URL:" << m_url.toString().toLocal8Bit()
<< "Network error: " << error; << "Network error: " << error;
m_status = Job_Failed; m_status = Job_Failed;
m_errorString = m_reply->errorString(); m_errorString = m_reply->errorString();
@ -74,7 +74,7 @@ void ByteArrayDownload::downloadFinished()
if (!redirectURL.isEmpty()) if (!redirectURL.isEmpty())
{ {
m_url = QUrl(redirect.toString()); m_url = QUrl(redirect.toString());
QLOG_INFO() << "Following redirect to " << m_url.toString(); qDebug() << "Following redirect to " << m_url.toString();
start(); start();
return; return;
} }

View File

@ -19,7 +19,7 @@
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QFileInfo> #include <QFileInfo>
#include <QDateTime> #include <QDateTime>
#include "logger/QsLog.h" #include <QDebug>
#include "logic/Env.h" #include "logic/Env.h"
CacheDownload::CacheDownload(QUrl url, MetaEntryPtr entry) 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 there already is a file and md5 checking is in effect and it can be opened
if (!ensureFilePathExists(m_target_path)) 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; m_status = Job_Failed;
emit failed(m_index_within_job); emit failed(m_index_within_job);
return; return;
} }
if (!m_output_file->open(QIODevice::WriteOnly)) 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; m_status = Job_Failed;
emit failed(m_index_within_job); emit failed(m_index_within_job);
return; return;
} }
QLOG_INFO() << "Downloading " << m_url.toString(); qDebug() << "Downloading " << m_url.toString();
QNetworkRequest request(m_url); QNetworkRequest request(m_url);
// check file consistency first. // check file consistency first.
@ -96,7 +96,7 @@ void CacheDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
void CacheDownload::downloadError(QNetworkReply::NetworkError error) void CacheDownload::downloadError(QNetworkReply::NetworkError error)
{ {
// error happened during download. // 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; m_status = Job_Failed;
} }
void CacheDownload::downloadFinished() void CacheDownload::downloadFinished()
@ -117,7 +117,7 @@ void CacheDownload::downloadFinished()
if (!redirectURL.isEmpty()) if (!redirectURL.isEmpty())
{ {
m_url = QUrl(redirect.toString()); m_url = QUrl(redirect.toString());
QLOG_INFO() << "Following redirect to " << m_url.toString(); qDebug() << "Following redirect to " << m_url.toString();
start(); start();
return; return;
} }
@ -142,7 +142,7 @@ void CacheDownload::downloadFinished()
} }
else 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_output_file->cancelWriting();
m_reply.reset(); m_reply.reset();
m_status = Job_Failed; m_status = Job_Failed;
@ -181,7 +181,7 @@ void CacheDownload::downloadReadyRead()
md5sum.addData(ba); md5sum.addData(ba);
if (m_output_file->write(ba) != ba.size()) 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_status = Job_Failed;
m_reply->abort(); m_reply->abort();
emit failed(m_index_within_job); emit failed(m_index_within_job);

View File

@ -24,7 +24,7 @@
#include <QDateTime> #include <QDateTime>
#include <QCryptographicHash> #include <QCryptographicHash>
#include "logger/QsLog.h" #include <QDebug>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonArray> #include <QJsonArray>
@ -122,13 +122,13 @@ bool HttpMetaCache::updateEntry(MetaEntryPtr stale_entry)
{ {
if (!m_entries.contains(stale_entry->base)) 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(); << stale_entry->base.toLocal8Bit();
return false; return false;
} }
if (stale_entry->stale) 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; return false;
} }
m_entries[stale_entry->base].entry_list[stale_entry->path] = stale_entry; m_entries[stale_entry->base].entry_list[stale_entry->path] = stale_entry;

View File

@ -17,7 +17,7 @@
#include "MD5EtagDownload.h" #include "MD5EtagDownload.h"
#include <pathutils.h> #include <pathutils.h>
#include <QCryptographicHash> #include <QCryptographicHash>
#include "logger/QsLog.h" #include <QDebug>
MD5EtagDownload::MD5EtagDownload(QUrl url, QString target_path) : NetAction() MD5EtagDownload::MD5EtagDownload(QUrl url, QString target_path) : NetAction()
{ {
@ -45,7 +45,7 @@ void MD5EtagDownload::start()
// skip if they match // skip if they match
if(m_local_md5 == m_expected_md5) 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); emit succeeded(m_index_within_job);
return; return;
} }
@ -63,14 +63,14 @@ void MD5EtagDownload::start()
QNetworkRequest request(m_url); 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()) if(!m_local_md5.isEmpty())
{ {
request.setRawHeader(QString("If-None-Match").toLatin1(), m_local_md5.toLatin1()); request.setRawHeader(QString("If-None-Match").toLatin1(), m_local_md5.toLatin1());
} }
if(!m_expected_md5.isEmpty()) if(!m_expected_md5.isEmpty())
QLOG_INFO() << "Expecting " << m_expected_md5; qDebug() << "Expecting " << m_expected_md5;
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); 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) 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_reply->url();
m_status = Job_Failed; m_status = Job_Failed;
} }
@ -120,7 +120,7 @@ void MD5EtagDownload::downloadFinished()
// FIXME: compare with the real written data md5sum // FIXME: compare with the real written data md5sum
// this is just an ETag // 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(); m_reply.reset();
emit succeeded(m_index_within_job); emit succeeded(m_index_within_job);

View File

@ -19,7 +19,7 @@
#include "ByteArrayDownload.h" #include "ByteArrayDownload.h"
#include "CacheDownload.h" #include "CacheDownload.h"
#include "logger/QsLog.h" #include <QDebug>
void NetJob::partSucceeded(int index) void NetJob::partSucceeded(int index)
{ {
@ -66,7 +66,7 @@ void NetJob::partProgress(int index, qint64 bytesReceived, qint64 bytesTotal)
void NetJob::start() void NetJob::start()
{ {
QLOG_INFO() << m_job_name.toLocal8Bit() << " started."; qDebug() << m_job_name.toLocal8Bit() << " started.";
m_running = true; m_running = true;
for (int i = 0; i < downloads.size(); i++) for (int i = 0; i < downloads.size(); i++)
{ {
@ -85,12 +85,12 @@ void NetJob::startMoreParts()
{ {
if(!m_failed.size()) if(!m_failed.size())
{ {
QLOG_INFO() << m_job_name.toLocal8Bit() << "succeeded."; qDebug() << m_job_name.toLocal8Bit() << "succeeded.";
emit succeeded(); emit succeeded();
} }
else else
{ {
QLOG_ERROR() << m_job_name.toLocal8Bit() << "failed."; qCritical() << m_job_name.toLocal8Bit() << "failed.";
emit failed(); emit failed();
} }
} }

View File

@ -1,6 +1,6 @@
#include "PasteUpload.h" #include "PasteUpload.h"
#include "logic/Env.h" #include "logic/Env.h"
#include "logger/QsLog.h" #include <QDebug>
#include <QJsonObject> #include <QJsonObject>
#include <QJsonDocument> #include <QJsonDocument>
@ -40,7 +40,7 @@ void PasteUpload::executeTask()
void PasteUpload::downloadError(QNetworkReply::NetworkError error) void PasteUpload::downloadError(QNetworkReply::NetworkError error)
{ {
// error happened during download. // error happened during download.
QLOG_ERROR() << "Network error: " << error; qCritical() << "Network error: " << error;
emitFailed(m_reply->errorString()); emitFailed(m_reply->errorString());
} }
@ -80,7 +80,7 @@ bool PasteUpload::parseResult(QJsonDocument doc)
auto status = object.value("status").toString("error"); auto status = object.value("status").toString("error");
if (status == "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; return false;
} }
m_pasteLink = object.value("paste").toObject().value("link").toString(); m_pasteLink = object.value("paste").toObject().value("link").toString();

View File

@ -18,7 +18,7 @@
#include <QByteArray> #include <QByteArray>
#include <QDomDocument> #include <QDomDocument>
#include <logger/QsLog.h> #include <QDebug>
NewsChecker::NewsChecker(const QString& feedUrl) NewsChecker::NewsChecker(const QString& feedUrl)
{ {
@ -30,11 +30,11 @@ void NewsChecker::reloadNews()
// Start a netjob to download the RSS feed and call rssDownloadFinished() when it's done. // Start a netjob to download the RSS feed and call rssDownloadFinished() when it's done.
if (isLoadingNews()) if (isLoadingNews())
{ {
QLOG_INFO() << "Ignored request to reload news. Currently reloading already."; qDebug() << "Ignored request to reload news. Currently reloading already.";
return; return;
} }
QLOG_INFO() << "Reloading news."; qDebug() << "Reloading news.";
NetJob* job = new NetJob("News RSS Feed"); NetJob* job = new NetJob("News RSS Feed");
job->addNetAction(ByteArrayDownload::make(m_feedUrl)); job->addNetAction(ByteArrayDownload::make(m_feedUrl));
@ -47,7 +47,7 @@ void NewsChecker::reloadNews()
void NewsChecker::rssDownloadFinished() void NewsChecker::rssDownloadFinished()
{ {
// Parse the XML file and process the RSS feed entries. // Parse the XML file and process the RSS feed entries.
QLOG_DEBUG() << "Finished loading RSS feed."; qDebug() << "Finished loading RSS feed.";
QByteArray data; QByteArray data;
{ {
@ -83,12 +83,12 @@ void NewsChecker::rssDownloadFinished()
QString errorMsg = "An unknown error occurred."; QString errorMsg = "An unknown error occurred.";
if (NewsEntry::fromXmlElement(element, entry.get(), &errorMsg)) if (NewsEntry::fromXmlElement(element, entry.get(), &errorMsg))
{ {
QLOG_DEBUG() << "Loaded news entry" << entry->title; qDebug() << "Loaded news entry" << entry->title;
m_newsEntries.append(entry); m_newsEntries.append(entry);
} }
else else
{ {
QLOG_WARN() << "Failed to load news entry at index" << i << ":" << errorMsg; qWarning() << "Failed to load news entry at index" << i << ":" << errorMsg;
} }
} }
@ -120,7 +120,7 @@ QString NewsChecker::getLastLoadErrorMsg() const
void NewsChecker::succeed() void NewsChecker::succeed()
{ {
m_lastLoadError = ""; m_lastLoadError = "";
QLOG_DEBUG() << "News loading succeeded."; qDebug() << "News loading succeeded.";
m_newsNetJob.reset(); m_newsNetJob.reset();
emit newsLoaded(); emit newsLoaded();
} }
@ -128,7 +128,7 @@ void NewsChecker::succeed()
void NewsChecker::fail(const QString& errorMsg) void NewsChecker::fail(const QString& errorMsg)
{ {
m_lastLoadError = errorMsg; m_lastLoadError = errorMsg;
QLOG_DEBUG() << "Failed to load news:" << errorMsg; qDebug() << "Failed to load news:" << errorMsg;
m_newsNetJob.reset(); m_newsNetJob.reset();
emit newsLoadingFailed(errorMsg); emit newsLoadingFailed(errorMsg);
} }

View File

@ -8,7 +8,7 @@
#include "logic/net/URLConstants.h" #include "logic/net/URLConstants.h"
#include "logic/Env.h" #include "logic/Env.h"
#include "logger/QsLog.h" #include <QDebug>
ImgurAlbumCreation::ImgurAlbumCreation(QList<ScreenshotPtr> screenshots) : NetAction(), m_screenshots(screenshots) ImgurAlbumCreation::ImgurAlbumCreation(QList<ScreenshotPtr> screenshots) : NetAction(), m_screenshots(screenshots)
{ {
@ -44,7 +44,7 @@ void ImgurAlbumCreation::start()
} }
void ImgurAlbumCreation::downloadError(QNetworkReply::NetworkError error) void ImgurAlbumCreation::downloadError(QNetworkReply::NetworkError error)
{ {
QLOG_DEBUG() << m_reply->errorString(); qDebug() << m_reply->errorString();
m_status = Job_Failed; m_status = Job_Failed;
} }
void ImgurAlbumCreation::downloadFinished() void ImgurAlbumCreation::downloadFinished()
@ -57,14 +57,14 @@ void ImgurAlbumCreation::downloadFinished()
QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError); QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError);
if (jsonError.error != QJsonParseError::NoError) if (jsonError.error != QJsonParseError::NoError)
{ {
QLOG_DEBUG() << jsonError.errorString(); qDebug() << jsonError.errorString();
emit failed(m_index_within_job); emit failed(m_index_within_job);
return; return;
} }
auto object = doc.object(); auto object = doc.object();
if (!object.value("success").toBool()) if (!object.value("success").toBool())
{ {
QLOG_DEBUG() << doc.toJson(); qDebug() << doc.toJson();
emit failed(m_index_within_job); emit failed(m_index_within_job);
return; return;
} }
@ -76,7 +76,7 @@ void ImgurAlbumCreation::downloadFinished()
} }
else else
{ {
QLOG_DEBUG() << m_reply->readAll(); qDebug() << m_reply->readAll();
m_reply.reset(); m_reply.reset();
emit failed(m_index_within_job); emit failed(m_index_within_job);
return; return;

View File

@ -10,7 +10,7 @@
#include "logic/net/URLConstants.h" #include "logic/net/URLConstants.h"
#include "logic/Env.h" #include "logic/Env.h"
#include "logger/QsLog.h" #include <QDebug>
ImgurUpload::ImgurUpload(ScreenshotPtr shot) : NetAction(), m_shot(shot) ImgurUpload::ImgurUpload(ScreenshotPtr shot) : NetAction(), m_shot(shot)
{ {
@ -59,7 +59,7 @@ void ImgurUpload::start()
} }
void ImgurUpload::downloadError(QNetworkReply::NetworkError error) void ImgurUpload::downloadError(QNetworkReply::NetworkError error)
{ {
QLOG_DEBUG() << m_reply->errorString(); qDebug() << m_reply->errorString();
m_status = Job_Failed; m_status = Job_Failed;
} }
void ImgurUpload::downloadFinished() void ImgurUpload::downloadFinished()
@ -72,14 +72,14 @@ void ImgurUpload::downloadFinished()
QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError); QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError);
if (jsonError.error != QJsonParseError::NoError) if (jsonError.error != QJsonParseError::NoError)
{ {
QLOG_DEBUG() << jsonError.errorString(); qDebug() << jsonError.errorString();
emit failed(m_index_within_job); emit failed(m_index_within_job);
return; return;
} }
auto object = doc.object(); auto object = doc.object();
if (!object.value("success").toBool()) if (!object.value("success").toBool())
{ {
QLOG_DEBUG() << doc.toJson(); qDebug() << doc.toJson();
emit failed(m_index_within_job); emit failed(m_index_within_job);
return; return;
} }
@ -91,7 +91,7 @@ void ImgurUpload::downloadFinished()
} }
else else
{ {
QLOG_DEBUG() << m_reply->readAll(); qDebug() << m_reply->readAll();
m_reply.reset(); m_reply.reset();
emit failed(m_index_within_job); emit failed(m_index_within_job);
return; return;

View File

@ -16,7 +16,7 @@
#include "logic/settings/SettingsObject.h" #include "logic/settings/SettingsObject.h"
#include "logic/settings/Setting.h" #include "logic/settings/Setting.h"
#include "logic/settings/OverrideSetting.h" #include "logic/settings/OverrideSetting.h"
#include "logger/QsLog.h" #include <QDebug>
#include <QVariant> #include <QVariant>
@ -33,7 +33,7 @@ std::shared_ptr<Setting> SettingsObject::registerOverride(std::shared_ptr<Settin
{ {
if (contains(original->id())) if (contains(original->id()))
{ {
QLOG_ERROR() << QString("Failed to register setting %1. ID already exists.") qCritical() << QString("Failed to register setting %1. ID already exists.")
.arg(original->id()); .arg(original->id());
return nullptr; // Fail return nullptr; // Fail
} }
@ -50,7 +50,7 @@ std::shared_ptr<Setting> SettingsObject::registerSetting(QStringList synonyms, Q
return nullptr; return nullptr;
if (contains(synonyms.first())) if (contains(synonyms.first()))
{ {
QLOG_ERROR() << QString("Failed to register setting %1. ID already exists.") qCritical() << QString("Failed to register setting %1. ID already exists.")
.arg(synonyms.first()); .arg(synonyms.first());
return nullptr; // Fail return nullptr; // Fail
} }
@ -81,7 +81,7 @@ bool SettingsObject::set(const QString &id, QVariant value)
auto setting = getSetting(id); auto setting = getSetting(id);
if (!setting) if (!setting)
{ {
QLOG_ERROR() << QString("Error changing setting %1. Setting doesn't exist.").arg(id); qCritical() << QString("Error changing setting %1. Setting doesn't exist.").arg(id);
return false; return false;
} }
else else

View File

@ -20,7 +20,7 @@
#include <QByteArray> #include <QByteArray>
#include <QDomDocument> #include <QDomDocument>
#include <logger/QsLog.h> #include <QDebug>
StatusChecker::StatusChecker() StatusChecker::StatusChecker()
{ {
@ -37,11 +37,11 @@ void StatusChecker::reloadStatus()
{ {
if (isLoadingStatus()) if (isLoadingStatus())
{ {
// QLOG_INFO() << "Ignored request to reload status. Currently reloading already."; // qDebug() << "Ignored request to reload status. Currently reloading already.";
return; return;
} }
// QLOG_INFO() << "Reloading status."; // qDebug() << "Reloading status.";
NetJob* job = new NetJob("Status JSON"); NetJob* job = new NetJob("Status JSON");
job->addNetAction(ByteArrayDownload::make(URLConstants::MOJANG_STATUS_URL)); job->addNetAction(ByteArrayDownload::make(URLConstants::MOJANG_STATUS_URL));
@ -54,7 +54,7 @@ void StatusChecker::reloadStatus()
void StatusChecker::statusDownloadFinished() void StatusChecker::statusDownloadFinished()
{ {
QLOG_DEBUG() << "Finished loading status JSON."; qDebug() << "Finished loading status JSON.";
m_statusEntries.clear(); m_statusEntries.clear();
QByteArray data; QByteArray data;
{ {
@ -92,7 +92,7 @@ void StatusChecker::statusDownloadFinished()
if(value.type() == QVariant::Type::String) if(value.type() == QVariant::Type::String)
{ {
m_statusEntries.insert(key, value.toString()); m_statusEntries.insert(key, value.toString());
//QLOG_DEBUG() << "Status JSON object: " << key << m_statusEntries[key]; //qDebug() << "Status JSON object: " << key << m_statusEntries[key];
} }
else else
{ {
@ -134,7 +134,7 @@ void StatusChecker::succeed()
m_prevEntries = m_statusEntries; m_prevEntries = m_statusEntries;
} }
m_lastLoadError = ""; m_lastLoadError = "";
QLOG_DEBUG() << "Status loading succeeded."; qDebug() << "Status loading succeeded.";
m_statusNetJob.reset(); m_statusNetJob.reset();
emit statusLoading(false); emit statusLoading(false);
} }
@ -147,7 +147,7 @@ void StatusChecker::fail(const QString& errorMsg)
m_prevEntries = m_statusEntries; m_prevEntries = m_statusEntries;
} }
m_lastLoadError = errorMsg; m_lastLoadError = errorMsg;
QLOG_DEBUG() << "Failed to load status:" << errorMsg; qDebug() << "Failed to load status:" << errorMsg;
m_statusNetJob.reset(); m_statusNetJob.reset();
emit statusLoading(false); emit statusLoading(false);
} }

View File

@ -14,7 +14,7 @@
*/ */
#include "Task.h" #include "Task.h"
#include "logger/QsLog.h" #include <QDebug>
Task::Task(QObject *parent) : ProgressProvider(parent) Task::Task(QObject *parent) : ProgressProvider(parent)
{ {
@ -42,7 +42,7 @@ void Task::emitFailed(QString reason)
m_running = false; m_running = false;
m_succeeded = false; m_succeeded = false;
m_failReason = reason; m_failReason = reason;
QLOG_ERROR() << "Task failed: " << reason; qCritical() << "Task failed: " << reason;
emit failed(reason); emit failed(reason);
} }
@ -51,7 +51,7 @@ void Task::emitSucceeded()
if (!m_running) { return; } // Don't succeed twice. if (!m_running) { return; } // Don't succeed twice.
m_running = false; m_running = false;
m_succeeded = true; m_succeeded = true;
QLOG_INFO() << "Task succeeded"; qDebug() << "Task succeeded";
emit succeeded(); emit succeeded();
} }

View File

@ -4,14 +4,14 @@
#include "logic/net/CacheDownload.h" #include "logic/net/CacheDownload.h"
#include "logic/net/URLConstants.h" #include "logic/net/URLConstants.h"
#include "logic/Env.h" #include "logic/Env.h"
#include "logger/QsLog.h" #include <QDebug>
TranslationDownloader::TranslationDownloader() TranslationDownloader::TranslationDownloader()
{ {
} }
void TranslationDownloader::downloadTranslations() void TranslationDownloader::downloadTranslations()
{ {
QLOG_DEBUG() << "Downloading Translations Index..."; qDebug() << "Downloading Translations Index...";
m_index_job.reset(new NetJob("Translations Index")); m_index_job.reset(new NetJob("Translations Index"));
m_index_task = ByteArrayDownload::make(QUrl("http://files.multimc.org/translations/index")); m_index_task = ByteArrayDownload::make(QUrl("http://files.multimc.org/translations/index"));
m_index_job->addNetAction(m_index_task); m_index_job->addNetAction(m_index_task);
@ -21,7 +21,7 @@ void TranslationDownloader::downloadTranslations()
} }
void TranslationDownloader::indexRecieved() void TranslationDownloader::indexRecieved()
{ {
QLOG_DEBUG() << "Got translations index!"; qDebug() << "Got translations index!";
m_dl_job.reset(new NetJob("Translations")); m_dl_job.reset(new NetJob("Translations"));
QList<QByteArray> lines = m_index_task->m_data.split('\n'); QList<QByteArray> lines = m_index_task->m_data.split('\n');
for (const auto line : lines) for (const auto line : lines)
@ -42,13 +42,13 @@ void TranslationDownloader::indexRecieved()
} }
void TranslationDownloader::dlFailed() void TranslationDownloader::dlFailed()
{ {
QLOG_ERROR() << "Translations Download Failed!"; qCritical() << "Translations Download Failed!";
} }
void TranslationDownloader::dlGood() void TranslationDownloader::dlGood()
{ {
QLOG_DEBUG() << "Got translations!"; qDebug() << "Got translations!";
} }
void TranslationDownloader::indexFailed() void TranslationDownloader::indexFailed()
{ {
QLOG_ERROR() << "Translations Index Download Failed!"; qCritical() << "Translations Index Download Failed!";
} }

View File

@ -56,7 +56,7 @@ void DownloadUpdateTask::processChannels()
if (!checker->hasChannels()) if (!checker->hasChannels())
{ {
// We still couldn't load the channel list. Give up. Call loadVersionInfo and return. // We still couldn't load the channel list. Give up. Call loadVersionInfo and return.
QLOG_INFO() << "Reloading the channel list didn't work. Giving up."; qDebug() << "Reloading the channel list didn't work. Giving up.";
loadVersionInfo(); loadVersionInfo();
return; return;
} }
@ -70,7 +70,7 @@ void DownloadUpdateTask::processChannels()
{ {
if (channel.id == channelId) if (channel.id == channelId)
{ {
QLOG_INFO() << "Found matching channel."; qDebug() << "Found matching channel.";
m_cRepoUrl = channel.url; m_cRepoUrl = channel.url;
break; break;
} }
@ -89,7 +89,7 @@ void DownloadUpdateTask::findCurrentVersionInfo()
if (!checker->hasChannels()) if (!checker->hasChannels())
{ {
// Load the channel list and wait for it to finish loading. // Load the channel list and wait for it to finish loading.
QLOG_INFO() << "No channel list entries found. Will try reloading it."; qDebug() << "No channel list entries found. Will try reloading it.";
QObject::connect(checker.get(), &UpdateChecker::channelListLoaded, this, QObject::connect(checker.get(), &UpdateChecker::channelListLoaded, this,
&DownloadUpdateTask::processChannels); &DownloadUpdateTask::processChannels);
@ -110,7 +110,7 @@ void DownloadUpdateTask::loadVersionInfo()
// Find the index URL. // Find the index URL.
QUrl newIndexUrl = QUrl(m_nRepoUrl).resolved(QString::number(m_nVersionId) + ".json"); QUrl newIndexUrl = QUrl(m_nRepoUrl).resolved(QString::number(m_nVersionId) + ".json");
QLOG_DEBUG() << m_nRepoUrl << " turns into " << newIndexUrl; qDebug() << m_nRepoUrl << " turns into " << newIndexUrl;
// Add a net action to download the version info for the version we're updating to. // Add a net action to download the version info for the version we're updating to.
netJob->addNetAction(ByteArrayDownload::make(newIndexUrl)); netJob->addNetAction(ByteArrayDownload::make(newIndexUrl));
@ -120,7 +120,7 @@ void DownloadUpdateTask::loadVersionInfo()
{ {
QUrl cIndexUrl = QUrl(m_cRepoUrl).resolved(QString::number(m_cVersionId) + ".json"); QUrl cIndexUrl = QUrl(m_cRepoUrl).resolved(QString::number(m_cVersionId) + ".json");
netJob->addNetAction(ByteArrayDownload::make(cIndexUrl)); netJob->addNetAction(ByteArrayDownload::make(cIndexUrl));
QLOG_DEBUG() << m_cRepoUrl << " turns into " << cIndexUrl; qDebug() << m_cRepoUrl << " turns into " << cIndexUrl;
} }
// Connect slots so we know when it's done. // Connect slots so we know when it's done.
@ -152,14 +152,14 @@ void DownloadUpdateTask::vinfoDownloadFailed()
} }
// TODO: Give a more detailed error message. // TODO: Give a more detailed error message.
QLOG_ERROR() << "Failed to download version info files."; qCritical() << "Failed to download version info files.";
emitFailed(tr("Failed to download version info files.")); emitFailed(tr("Failed to download version info files."));
} }
void DownloadUpdateTask::parseDownloadedVersionInfo() void DownloadUpdateTask::parseDownloadedVersionInfo()
{ {
setStatus(tr("Reading file list for new version...")); setStatus(tr("Reading file list for new version..."));
QLOG_DEBUG() << "Reading file list for new version..."; qDebug() << "Reading file list for new version...";
QString error; QString error;
if (!parseVersionInfo( if (!parseVersionInfo(
std::dynamic_pointer_cast<ByteArrayDownload>(m_vinfoNetJob->first())->m_data, std::dynamic_pointer_cast<ByteArrayDownload>(m_vinfoNetJob->first())->m_data,
@ -174,7 +174,7 @@ void DownloadUpdateTask::parseDownloadedVersionInfo()
if (m_vinfoNetJob->size() >= 2 && m_vinfoNetJob->operator[](1)->m_status != Job_Failed) if (m_vinfoNetJob->size() >= 2 && m_vinfoNetJob->operator[](1)->m_status != Job_Failed)
{ {
setStatus(tr("Reading file list for current version...")); setStatus(tr("Reading file list for current version..."));
QLOG_DEBUG() << "Reading file list for current version..."; qDebug() << "Reading file list for current version...";
QString error; QString error;
parseVersionInfo( parseVersionInfo(
std::dynamic_pointer_cast<ByteArrayDownload>(m_vinfoNetJob->operator[](1))->m_data, std::dynamic_pointer_cast<ByteArrayDownload>(m_vinfoNetJob->operator[](1))->m_data,
@ -199,14 +199,14 @@ bool DownloadUpdateTask::parseVersionInfo(const QByteArray &data, VersionFileLis
*error = QString("Failed to parse version info JSON: %1 at %2") *error = QString("Failed to parse version info JSON: %1 at %2")
.arg(jsonError.errorString()) .arg(jsonError.errorString())
.arg(jsonError.offset); .arg(jsonError.offset);
QLOG_ERROR() << error; qCritical() << error;
return false; return false;
} }
QJsonObject json = jsonDoc.object(); QJsonObject json = jsonDoc.object();
QLOG_DEBUG() << data; qDebug() << data;
QLOG_DEBUG() << "Loading version info from JSON."; qDebug() << "Loading version info from JSON.";
QJsonArray filesArray = json.value("Files").toArray(); QJsonArray filesArray = json.value("Files").toArray();
for (QJsonValue fileValue : filesArray) for (QJsonValue fileValue : filesArray)
{ {
@ -223,7 +223,7 @@ bool DownloadUpdateTask::parseVersionInfo(const QByteArray &data, VersionFileLis
#endif #endif
VersionFileEntry file{file_path, fileObj.value("Perms").toVariant().toInt(), VersionFileEntry file{file_path, fileObj.value("Perms").toVariant().toInt(),
FileSourceList(), fileObj.value("MD5").toString(), }; FileSourceList(), fileObj.value("MD5").toString(), };
QLOG_DEBUG() << "File" << file.path << "with perms" << file.mode; qDebug() << "File" << file.path << "with perms" << file.mode;
QJsonArray sourceArray = fileObj.value("Sources").toArray(); QJsonArray sourceArray = fileObj.value("Sources").toArray();
for (QJsonValue val : sourceArray) for (QJsonValue val : sourceArray)
@ -244,11 +244,11 @@ bool DownloadUpdateTask::parseVersionInfo(const QByteArray &data, VersionFileLis
} }
else else
{ {
QLOG_WARN() << "Unknown source type" << type << "ignored."; qWarning() << "Unknown source type" << type << "ignored.";
} }
} }
QLOG_DEBUG() << "Loaded info for" << file.path; qDebug() << "Loaded info for" << file.path;
list->append(file); list->append(file);
} }
@ -276,7 +276,7 @@ void DownloadUpdateTask::processFileLists()
// Now start the download. // Now start the download.
setStatus(tr("Downloading %1 update files.").arg(QString::number(netJob->size()))); setStatus(tr("Downloading %1 update files.").arg(QString::number(netJob->size())));
QLOG_DEBUG() << "Begin downloading update files to" << m_updateFilesDir.path(); qDebug() << "Begin downloading update files to" << m_updateFilesDir.path();
m_filesNetJob.reset(netJob); m_filesNetJob.reset(netJob);
netJob->start(); netJob->start();
@ -298,7 +298,7 @@ DownloadUpdateTask::processFileLists(NetJob *job,
QFileInfo toDelete(PathCombine(m_rootPath, entry.path)); QFileInfo toDelete(PathCombine(m_rootPath, entry.path));
if (!toDelete.exists()) if (!toDelete.exists())
{ {
QLOG_ERROR() << "Expected file " << toDelete.absoluteFilePath() qCritical() << "Expected file " << toDelete.absoluteFilePath()
<< " doesn't exist!"; << " doesn't exist!";
} }
bool keep = false; bool keep = false;
@ -308,7 +308,7 @@ DownloadUpdateTask::processFileLists(NetJob *job,
{ {
if (newEntry.path == entry.path) if (newEntry.path == entry.path)
{ {
QLOG_DEBUG() << "Not deleting" << entry.path qDebug() << "Not deleting" << entry.path
<< "because it is still present in the new version."; << "because it is still present in the new version.";
keep = true; keep = true;
break; break;
@ -343,17 +343,17 @@ DownloadUpdateTask::processFileLists(NetJob *job,
bool pass = true; bool pass = true;
if (!entryInfo.isReadable()) if (!entryInfo.isReadable())
{ {
QLOG_ERROR() << "File " << realEntryPath << " is not readable."; qCritical() << "File " << realEntryPath << " is not readable.";
pass = false; pass = false;
} }
if (!entryInfo.isWritable()) if (!entryInfo.isWritable())
{ {
QLOG_ERROR() << "File " << realEntryPath << " is not writable."; qCritical() << "File " << realEntryPath << " is not writable.";
pass = false; pass = false;
} }
if (!entryFile.open(QFile::ReadOnly)) if (!entryFile.open(QFile::ReadOnly))
{ {
QLOG_ERROR() << "File " << realEntryPath << " cannot be opened for reading."; qCritical() << "File " << realEntryPath << " cannot be opened for reading.";
pass = false; pass = false;
} }
if (!pass) if (!pass)
@ -372,9 +372,9 @@ DownloadUpdateTask::processFileLists(NetJob *job,
fileMD5 = hash.result().toHex(); fileMD5 = hash.result().toHex();
if ((fileMD5 != entry.md5)) if ((fileMD5 != entry.md5))
{ {
QLOG_DEBUG() << "MD5Sum does not match!"; qDebug() << "MD5Sum does not match!";
QLOG_DEBUG() << "Expected:'" << entry.md5 << "'"; qDebug() << "Expected:'" << entry.md5 << "'";
QLOG_DEBUG() << "Got: '" << fileMD5 << "'"; qDebug() << "Got: '" << fileMD5 << "'";
needs_upgrade = true; needs_upgrade = true;
} }
} }
@ -382,12 +382,12 @@ DownloadUpdateTask::processFileLists(NetJob *job,
// skip file. it doesn't need an upgrade. // skip file. it doesn't need an upgrade.
if (!needs_upgrade) if (!needs_upgrade)
{ {
QLOG_DEBUG() << "File" << realEntryPath << " does not need updating."; qDebug() << "File" << realEntryPath << " does not need updating.";
continue; continue;
} }
// yep. this file actually needs an upgrade. PROCEED. // yep. this file actually needs an upgrade. PROCEED.
QLOG_DEBUG() << "Found file" << realEntryPath << " that needs updating."; qDebug() << "Found file" << realEntryPath << " that needs updating.";
// if it's the updater we want to treat it separately // if it's the updater we want to treat it separately
bool isUpdater = entry.path.endsWith("updater") || entry.path.endsWith("updater.exe"); bool isUpdater = entry.path.endsWith("updater") || entry.path.endsWith("updater.exe");
@ -399,7 +399,7 @@ DownloadUpdateTask::processFileLists(NetJob *job,
{ {
if (source.type == "http") if (source.type == "http")
{ {
QLOG_DEBUG() << "Will download" << entry.path << "from" << source.url; qDebug() << "Will download" << entry.path << "from" << source.url;
// Download it to updatedir/<filepath>-<md5> where filepath is the file's // Download it to updatedir/<filepath>-<md5> where filepath is the file's
// path with slashes replaced by underscores. // path with slashes replaced by underscores.
@ -410,12 +410,12 @@ DownloadUpdateTask::processFileLists(NetJob *job,
{ {
if(BuildConfig.UPDATER_FORCE_LOCAL) if(BuildConfig.UPDATER_FORCE_LOCAL)
{ {
QLOG_DEBUG() << "Skipping updater download and using local version."; qDebug() << "Skipping updater download and using local version.";
} }
else else
{ {
auto cache_entry = ENV.metacache()->resolveEntry("root", entry.path); auto cache_entry = ENV.metacache()->resolveEntry("root", entry.path);
QLOG_DEBUG() << "Updater will be in " << cache_entry->getFullPath(); qDebug() << "Updater will be in " << cache_entry->getFullPath();
// force check. // force check.
cache_entry->stale = true; cache_entry->stale = true;
@ -475,7 +475,7 @@ bool DownloadUpdateTask::writeInstallScript(UpdateOperationList &opsList, QStrin
file.appendChild(path); file.appendChild(path);
file.appendChild(mode); file.appendChild(mode);
installFiles.appendChild(file); installFiles.appendChild(file);
QLOG_DEBUG() << "Will install file " << op.file << " to " << op.dest; qDebug() << "Will install file " << op.file << " to " << op.dest;
} }
break; break;
@ -484,12 +484,12 @@ bool DownloadUpdateTask::writeInstallScript(UpdateOperationList &opsList, QStrin
// Delete the file. // Delete the file.
file.appendChild(doc.createTextNode(op.file)); file.appendChild(doc.createTextNode(op.file));
removeFiles.appendChild(file); removeFiles.appendChild(file);
QLOG_DEBUG() << "Will remove file" << op.file; qDebug() << "Will remove file" << op.file;
} }
break; break;
default: default:
QLOG_WARN() << "Can't write update operation of type" << op.type qWarning() << "Can't write update operation of type" << op.type
<< "to file. Not implemented."; << "to file. Not implemented.";
continue; continue;
} }
@ -521,7 +521,7 @@ bool DownloadUpdateTask::fixPathForOSX(QString &path)
} }
else else
{ {
QLOG_ERROR() << "Update path not within .app: " << path; qCritical() << "Update path not within .app: " << path;
return false; return false;
} }
} }
@ -534,7 +534,7 @@ void DownloadUpdateTask::fileDownloadFinished()
void DownloadUpdateTask::fileDownloadFailed() void DownloadUpdateTask::fileDownloadFailed()
{ {
// TODO: Give more info about the failure. // TODO: Give more info about the failure.
QLOG_ERROR() << "Failed to download update files."; qCritical() << "Failed to download update files.";
emitFailed(tr("Failed to download update files.")); emitFailed(tr("Failed to download update files."));
} }

View File

@ -7,7 +7,7 @@
#include "logic/Env.h" #include "logic/Env.h"
#include "BuildConfig.h" #include "BuildConfig.h"
#include "logic/net/CacheDownload.h" #include "logic/net/CacheDownload.h"
#include "logger/QsLog.h" #include <QDebug>
NotificationChecker::NotificationChecker(QObject *parent) NotificationChecker::NotificationChecker(QObject *parent)
: QObject(parent), m_notificationsUrl(QUrl(BuildConfig.NOTIFICATION_URL)) : QObject(parent), m_notificationsUrl(QUrl(BuildConfig.NOTIFICATION_URL))
@ -34,7 +34,7 @@ void NotificationChecker::checkForNotifications()
{ {
if (!m_notificationsUrl.isValid()) if (!m_notificationsUrl.isValid())
{ {
QLOG_ERROR() << "Failed to check for notifications. No notifications URL set." qCritical() << "Failed to check for notifications. No notifications URL set."
<< "If you'd like to use MultiMC's notification system, please pass the " << "If you'd like to use MultiMC's notification system, please pass the "
"URL to CMake at compile time."; "URL to CMake at compile time.";
return; return;

View File

@ -228,14 +228,14 @@ slots:
/* /*
void test_masterTest() void test_masterTest()
{ {
QLOG_INFO() << "#####################"; qDebug() << "#####################";
MMC->m_version.build = 1; MMC->m_version.build = 1;
MMC->m_version.channel = "develop"; MMC->m_version.channel = "develop";
auto channels = auto channels =
QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/channels.json")); QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/channels.json"));
auto root = QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/")); auto root = QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/"));
QLOG_DEBUG() << "channels: " << channels; qDebug() << "channels: " << channels;
QLOG_DEBUG() << "root: " << root; qDebug() << "root: " << root;
MMC->updateChecker()->setChannelListUrl(channels.toString()); MMC->updateChecker()->setChannelListUrl(channels.toString());
MMC->updateChecker()->setCurrentChannel("develop"); MMC->updateChecker()->setCurrentChannel("develop");