diff options
71 files changed, 415 insertions, 934 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1229bcfa..3751da3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -270,14 +270,6 @@ SET(MULTIMC_SOURCES BuildConfig.h ${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/GuiUtil.h gui/GuiUtil.cpp @@ -1,7 +1,7 @@ #pragma once #include <exception> #include <QString> -#include <logger/QsLog.h> +#include <QDebug> class MMCError : public std::exception { @@ -9,7 +9,7 @@ public: MMCError(QString cause) { exceptionCause = cause; - QLOG_ERROR() << "Exception: " + cause; + qCritical() << "Exception: " + cause; }; virtual ~MMCError() noexcept {} virtual const char *what() const noexcept diff --git a/MultiMC.cpp b/MultiMC.cpp index e3319c9a..03131008 100644 --- a/MultiMC.cpp +++ b/MultiMC.cpp @@ -10,6 +10,7 @@ #include <QMessageBox> #include <QStringList> #include <QDesktopServices> +#include <QDebug> #include "gui/dialogs/VersionSelectDialog.h" #include "logic/InstanceList.h" @@ -38,8 +39,7 @@ #include <xdgicon.h> #include "logic/settings/INISettingsObject.h" #include "logic/settings/Setting.h" -#include "logger/QsLog.h" -#include "logger/QsLogDest.h" + #include "logic/trans/TranslationDownloader.h" @@ -52,6 +52,8 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar setOrganizationName("MultiMC"); setApplicationName("MultiMC5"); + startTime = QDateTime::currentDateTime(); + setAttribute(Qt::AA_UseHighDpiPixmaps); // Don't quit on hiding the last window this->setQuitOnLastWindowClosed(false); @@ -129,7 +131,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar { // BAD STUFF. WHAT DO? initLogger(); - QLOG_ERROR() << "Failed to set work path. Will exit. NOW."; + qCritical() << "Failed to set work path. Will exit. NOW."; m_status = MultiMC::Failed; return; } @@ -166,22 +168,22 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar // init the logger initLogger(); - QLOG_INFO() << "MultiMC 5, (c) 2013-2015 MultiMC Contributors"; - QLOG_INFO() << "Version : " << BuildConfig.VERSION_STR; - QLOG_INFO() << "Git commit : " << BuildConfig.GIT_COMMIT; + qDebug() << "MultiMC 5, (c) 2013-2015 MultiMC Contributors"; + qDebug() << "Version : " << BuildConfig.VERSION_STR; + qDebug() << "Git commit : " << BuildConfig.GIT_COMMIT; if (adjustedBy.size()) { - QLOG_INFO() << "Work dir before adjustment : " << origcwdPath; - QLOG_INFO() << "Work dir after adjustment : " << QDir::currentPath(); - QLOG_INFO() << "Adjusted by : " << adjustedBy; + qDebug() << "Work dir before adjustment : " << origcwdPath; + qDebug() << "Work dir after adjustment : " << QDir::currentPath(); + qDebug() << "Adjusted by : " << adjustedBy; } else { - QLOG_INFO() << "Work dir : " << QDir::currentPath(); + qDebug() << "Work dir : " << QDir::currentPath(); } - QLOG_INFO() << "Binary path : " << binPath; - QLOG_INFO() << "Application root path : " << rootPath; - QLOG_INFO() << "Static data path : " << staticDataPath; + qDebug() << "Binary path : " << binPath; + qDebug() << "Application root path : " << rootPath; + qDebug() << "Static data path : " << staticDataPath; // load settings 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 // 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(); - QLOG_INFO() << "Instance path : " << instDir; + qDebug() << "Instance path : " << instDir; if (checkProblemticPathJava(QDir(instDir))) { - QLOG_WARN() + qWarning() << "Your instance path contains \'!\' and this is known to cause java problems"; } m_instances.reset(new InstanceList(m_settings, InstDirSetting->get().toString(), this)); - QLOG_INFO() << "Loading Instances..."; + qDebug() << "Loading Instances..."; m_instances->loadList(); connect(InstDirSetting.get(), SIGNAL(SettingChanged(const Setting &, QVariant)), m_instances.get(), SLOT(on_InstFolderChanged(const Setting &, QVariant))); // and accounts m_accounts.reset(new MojangAccountList(this)); - QLOG_INFO() << "Loading accounts..."; + qDebug() << "Loading accounts..."; m_accounts->setListFilePath("accounts.json", true); m_accounts->loadList(); @@ -275,16 +277,16 @@ void MultiMC::initTranslations() { QLocale locale(m_settings->get("Language").toString()); QLocale::setDefault(locale); - QLOG_INFO() << "Your language is" << locale.bcp47Name(); + qDebug() << "Your language is" << locale.bcp47Name(); m_qt_translator.reset(new QTranslator()); if (m_qt_translator->load("qt_" + locale.bcp47Name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) { - QLOG_DEBUG() << "Loading Qt Language File for" + qDebug() << "Loading Qt Language File for" << locale.bcp47Name().toLocal8Bit().constData() << "..."; if (!installTranslator(m_qt_translator.get())) { - QLOG_ERROR() << "Loading Qt Language File failed."; + qCritical() << "Loading Qt Language File failed."; m_qt_translator.reset(); } } @@ -296,11 +298,11 @@ void MultiMC::initTranslations() m_mmc_translator.reset(new QTranslator()); 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() << "..."; if (!installTranslator(m_mmc_translator.get())) { - QLOG_ERROR() << "Loading MMC Language File failed."; + qCritical() << "Loading MMC Language File failed."; m_mmc_translator.reset(); } } @@ -327,6 +329,28 @@ void moveFile(const QString &oldName, const QString &newName) QFile::copy(oldName, newName); 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() { static const QString logBase = "MultiMC-%0.log"; @@ -336,15 +360,10 @@ void MultiMC::initLogger() moveFile(logBase.arg(1), logBase.arg(2)); moveFile(logBase.arg(0), logBase.arg(1)); - // init the logging mechanism - QsLogging::Logger &logger = QsLogging::Logger::instance(); - logger.setLoggingLevel(QsLogging::TraceLevel); - m_fileDestination = QsLogging::DestinationFactory::MakeFileDestination(logBase.arg(0)); - m_debugDestination = QsLogging::DestinationFactory::MakeDebugOutputDestination(); - logger.addDestination(m_fileDestination.get()); - logger.addDestination(m_debugDestination.get()); - // log all the things - logger.setLoggingLevel(QsLogging::TraceLevel); + qInstallMessageHandler(appDebugOutput); + + logFile = std::make_shared<QFile>(logBase.arg(0)); + logFile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); } void MultiMC::initGlobalSettings(bool test_mode) @@ -381,7 +400,7 @@ void MultiMC::initGlobalSettings(bool test_mode) QFontInfo consoleFontInfo(consoleFont); QString resolvedDefaultMonospace = consoleFontInfo.family(); QFont resolvedFont(resolvedDefaultMonospace); - QLOG_DEBUG() << "Detected default console font:" << resolvedDefaultMonospace + qDebug() << "Detected default console font:" << resolvedDefaultMonospace << ", substitutions:" << resolvedFont.substitutions().join(','); m_settings->registerSetting("ConsoleFont", resolvedDefaultMonospace); } @@ -527,7 +546,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags) m_updateOnExitFlags = None; m_updateOnExitPath.clear(); } - QLOG_INFO() << "Installing updates."; + qDebug() << "Installing updates."; #ifdef WINDOWS QString finishCmd = applicationFilePath(); QString updaterBinary = PathCombine(applicationDirPath(), "updater.exe"); @@ -555,12 +574,12 @@ void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags) args << "--finish-cmd" << finishCmd; 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); if (!QProcess::startDetached(updaterBinary, args /*, root()*/)) { - QLOG_ERROR() << "Failed to start the updater process!"; + qCritical() << "Failed to start the updater process!"; return; } @@ -590,6 +609,11 @@ void MultiMC::onExit() installUpdates(m_updateOnExitPath, m_updateOnExitFlags); } ENV.destroy(); + if(logFile) + { + logFile->flush(); + logFile->close(); + } } bool MultiMC::openJsonEditor(const QString &filename) @@ -2,11 +2,12 @@ #include <QApplication> #include <memory> -#include "logger/QsLog.h" -#include "logger/QsLogDest.h" +#include <QDebug> #include <QFlag> #include <QIcon> +#include <QDateTime> +class QFile; class MinecraftVersionList; class LWJGLVersionList; class HttpMetaCache; @@ -62,7 +63,10 @@ public: return m_settings; } - + qint64 timeSinceStart() const + { + return startTime.msecsTo(QDateTime::currentDateTime()); + } QIcon getThemedIcon(const QString& name); @@ -153,6 +157,8 @@ private: friend class UpdateCheckerTest; friend class DownloadUpdateTaskTest; + QDateTime startTime; + std::shared_ptr<QTranslator> m_qt_translator; std::shared_ptr<QTranslator> m_mmc_translator; std::shared_ptr<SettingsObject> m_settings; @@ -169,9 +175,6 @@ private: QMap<QString, std::shared_ptr<BaseProfilerFactory>> m_profilers; QMap<QString, std::shared_ptr<BaseDetachedToolFactory>> m_tools; - QsLogging::DestinationPtr m_fileDestination; - QsLogging::DestinationPtr m_debugDestination; - QString m_updateOnExitPath; UpdateFlags m_updateOnExitFlags = None; @@ -180,4 +183,6 @@ private: QString dataPath; Status m_status = MultiMC::Failed; +public: + std::shared_ptr<QFile> logFile; }; diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index f0d882ba..2025a097 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -916,7 +916,7 @@ void MainWindow::updateAvailable(QString repo, QString versionName, int versionI switch (action) { case UPDATE_LATER: - QLOG_INFO() << "Update will be installed later."; + qDebug() << "Update will be installed later."; break; case UPDATE_NOW: downloadUpdates(repo, versionId); @@ -975,7 +975,7 @@ void MainWindow::notificationsChanged() 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 // background. // 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; 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()) { CustomMessageBox::selectable(this, tr("Error"), @@ -1730,7 +1730,7 @@ void MainWindow::doLaunch(bool online, BaseProfilerFactory *profiler) { case AuthSession::Undetermined: { - QLOG_ERROR() << "Received undetermined session status during login. Bye."; + qCritical() << "Received undetermined session status during login. Bye."; tryagain = false; break; } @@ -2004,7 +2004,7 @@ void MainWindow::checkSetDefaultJava() if (askForJava) { - QLOG_DEBUG() << "Java path needs resetting, showing Java selection dialog..."; + qDebug() << "Java path needs resetting, showing Java selection dialog..."; JavaVersionPtr java; diff --git a/gui/dialogs/AccountSelectDialog.cpp b/gui/dialogs/AccountSelectDialog.cpp index 4d10112e..6ae60738 100644 --- a/gui/dialogs/AccountSelectDialog.cpp +++ b/gui/dialogs/AccountSelectDialog.cpp @@ -18,7 +18,7 @@ #include <QItemSelectionModel> -#include <logger/QsLog.h> +#include <QDebug> #include <gui/dialogs/ProgressDialog.h> @@ -40,7 +40,7 @@ AccountSelectDialog::AccountSelectDialog(const QString &message, int flags, QWid // Flags... ui->globalDefaultCheck->setVisible(flags & GlobalDefaultCheckbox); ui->instDefaultCheck->setVisible(flags & InstanceDefaultCheckbox); - QLOG_DEBUG() << flags; + qDebug() << flags; // Select the first entry in the list. ui->listView->setCurrentIndex(ui->listView->model()->index(0, 0)); diff --git a/gui/dialogs/UpdateDialog.cpp b/gui/dialogs/UpdateDialog.cpp index 29d09ead..1fcc156a 100644 --- a/gui/dialogs/UpdateDialog.cpp +++ b/gui/dialogs/UpdateDialog.cpp @@ -1,7 +1,7 @@ #include "UpdateDialog.h" #include "ui_UpdateDialog.h" #include "gui/Platform.h" -#include "logger/QsLog.h" +#include <QDebug> #include "MultiMC.h" #include <logic/settings/SettingsObject.h> @@ -82,7 +82,7 @@ QString reprocessMarkdown(QString markdown) html << "<ul>\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; case LIST1: if(line.startsWith("##")) @@ -107,7 +107,7 @@ QString reprocessMarkdown(QString markdown) html << "<ul>\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; case LIST2: if(line.startsWith("##")) @@ -134,7 +134,7 @@ QString reprocessMarkdown(QString markdown) { 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; } i++; @@ -151,10 +151,10 @@ QString reprocessMarkdown(QString markdown) } 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"; - QLOG_DEBUG() << htmlData; + qDebug() << htmlData; return htmlData; } diff --git a/gui/dialogs/VersionSelectDialog.cpp b/gui/dialogs/VersionSelectDialog.cpp index e9758d55..a0a58699 100644 --- a/gui/dialogs/VersionSelectDialog.cpp +++ b/gui/dialogs/VersionSelectDialog.cpp @@ -25,7 +25,7 @@ #include <logic/BaseVersionList.h> #include <logic/tasks/Task.h> #include <depends/util/include/modutils.h> -#include "logger/QsLog.h" +#include <QDebug> class VersionSelectProxyModel : public QSortFilterProxyModel { diff --git a/gui/groupview/GroupView.cpp b/gui/groupview/GroupView.cpp index 502cf259..89694b87 100644 --- a/gui/groupview/GroupView.cpp +++ b/gui/groupview/GroupView.cpp @@ -12,7 +12,7 @@ #include <QScrollBar> #include "VisualGroup.h" -#include "logger/QsLog.h" +#include <QDebug> template <typename T> bool listsIntersect(const QList<T> &l1, const QList<T> t2) { diff --git a/gui/groupview/GroupedProxyModel.cpp b/gui/groupview/GroupedProxyModel.cpp index 30845caa..a45c5ae9 100644 --- a/gui/groupview/GroupedProxyModel.cpp +++ b/gui/groupview/GroupedProxyModel.cpp @@ -1,7 +1,7 @@ #include "GroupedProxyModel.h" #include "GroupView.h" -#include "logger/QsLog.h" +#include <QDebug> GroupedProxyModel::GroupedProxyModel(QObject *parent) : QSortFilterProxyModel(parent) { @@ -21,16 +21,16 @@ bool GroupedProxyModel::lessThan(const QModelIndex &left, const QModelIndex &rig auto result = leftCategory.localeAwareCompare(rightCategory); if(result < 0) { - QLOG_DEBUG() << leftCategory << "<" << rightCategory; + qDebug() << leftCategory << "<" << rightCategory; } if(result == 0) { - QLOG_DEBUG() << leftCategory << "=" << rightCategory; + qDebug() << leftCategory << "=" << rightCategory; return subSortLessThan(left, right); } if(result > 0) { - QLOG_DEBUG() << leftCategory << ">" << rightCategory; + qDebug() << leftCategory << ">" << rightCategory; } return result < 0; } diff --git a/gui/pages/global/AccountListPage.cpp b/gui/pages/global/AccountListPage.cpp index 2de77115..72e18405 100644 --- a/gui/pages/global/AccountListPage.cpp +++ b/gui/pages/global/AccountListPage.cpp @@ -18,7 +18,7 @@ #include <QItemSelectionModel> -#include <logger/QsLog.h> +#include <QDebug> #include "logic/net/NetJob.h" #include "logic/net/URLConstants.h" diff --git a/gui/pages/global/MultiMCPage.cpp b/gui/pages/global/MultiMCPage.cpp index 3226de83..d2934666 100644 --- a/gui/pages/global/MultiMCPage.cpp +++ b/gui/pages/global/MultiMCPage.cpp @@ -212,7 +212,7 @@ void MultiMCPage::refreshUpdateChannelList() // the combo box to it. if (entry.id == m_currentUpdateChannel) { - QLOG_DEBUG() << "Selected index" << i << "channel id" << m_currentUpdateChannel; + qDebug() << "Selected index" << i << "channel id" << m_currentUpdateChannel; selection = i; } } diff --git a/logger/QsDebugOutput.cpp b/logger/QsDebugOutput.cpp deleted file mode 100644 index d68cd5e9..00000000 --- a/logger/QsDebugOutput.cpp +++ /dev/null @@ -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 diff --git a/logger/QsDebugOutput.h b/logger/QsDebugOutput.h deleted file mode 100644 index 8c759a6d..00000000 --- a/logger/QsDebugOutput.h +++ /dev/null @@ -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); -}; diff --git a/logger/QsLog.cpp b/logger/QsLog.cpp deleted file mode 100644 index 68493963..00000000 --- a/logger/QsLog.cpp +++ /dev/null @@ -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 diff --git a/logger/QsLog.h b/logger/QsLog.h deleted file mode 100644 index 2b7984e6..00000000 --- a/logger/QsLog.h +++ /dev/null @@ -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__ -*/ diff --git a/logger/QsLogDest.cpp b/logger/QsLogDest.cpp deleted file mode 100644 index 4a47060e..00000000 --- a/logger/QsLogDest.cpp +++ /dev/null @@ -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 diff --git a/logger/QsLogDest.h b/logger/QsLogDest.h deleted file mode 100644 index a8000022..00000000 --- a/logger/QsLogDest.h +++ /dev/null @@ -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 diff --git a/logic/BaseProcess.cpp b/logic/BaseProcess.cpp index d65e76d9..eb1bbfdc 100644 --- a/logic/BaseProcess.cpp +++ b/logic/BaseProcess.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ #include "logic/BaseProcess.h" -#include "logger/QsLog.h" +#include <QDebug> #include <QDir> #include <QEventLoop> @@ -71,20 +71,20 @@ void BaseProcess::init() // filter out dangerous java crap if(ignored.contains(key)) { - QLOG_INFO() << "Env: ignoring" << key << value; + qDebug() << "Env: ignoring" << key << value; continue; } // filter MultiMC-related things if(key.startsWith("QT_")) { - QLOG_INFO() << "Env: ignoring" << key << value; + qDebug() << "Env: ignoring" << key << value; continue; } #ifdef LINUX // Do not pass LD_* variables to java. They were intended for MultiMC if(key.startsWith("LD_")) { - QLOG_INFO() << "Env: ignoring" << key << value; + qDebug() << "Env: ignoring" << key << value; continue; } // Strip IBus @@ -93,10 +93,10 @@ void BaseProcess::init() { QString save = value; value.replace(IBUS, ""); - QLOG_INFO() << "Env: stripped" << IBUS << "from" << save << ":" << value; + qDebug() << "Env: stripped" << IBUS << "from" << save << ":" << value; } #endif - QLOG_INFO() << "Env: " << key << value; + qDebug() << "Env: " << key << value; env.insert(key, value); } #ifdef LINUX diff --git a/logic/Env.cpp b/logic/Env.cpp index 68e76e4b..69986be2 100644 --- a/logic/Env.cpp +++ b/logic/Env.cpp @@ -6,7 +6,7 @@ #include <QDir> #include <QNetworkProxy> #include <QNetworkAccessManager> -#include "logger/QsLog.h" +#include <QDebug> #include "logic/tasks/Task.h" #include <QDebug> @@ -175,14 +175,14 @@ void Env::updateProxySettings(QString proxyTypeStr, QString addr, int port, QStr QNetworkProxyFactory::setUseSystemConfiguration(true); } - QLOG_INFO() << "Detecting proxy settings..."; + qDebug() << "Detecting proxy settings..."; QNetworkProxy proxy = QNetworkProxy::applicationProxy(); if (m_qnam.get()) m_qnam->setProxy(proxy); QString proxyDesc; if (proxy.type() == QNetworkProxy::NoProxy) { - QLOG_INFO() << "Using no proxy is an option!"; + qDebug() << "Using no proxy is an option!"; return; } switch (proxy.type()) @@ -211,7 +211,7 @@ void Env::updateProxySettings(QString proxyTypeStr, QString addr, int port, QStr .arg(proxy.port()) .arg(proxy.user()) .arg(proxy.password()); - QLOG_INFO() << proxyDesc; + qDebug() << proxyDesc; } #include "Env.moc"
\ No newline at end of file diff --git a/logic/InstanceList.cpp b/logic/InstanceList.cpp index 657fd5b4..ef6594d9 100644 --- a/logic/InstanceList.cpp +++ b/logic/InstanceList.cpp @@ -34,7 +34,7 @@ #include "settings/INISettingsObject.h" #include "OneSixInstance.h" #include "LegacyInstance.h" -#include "logger/QsLog.h" +#include <QDebug> const static int GROUP_FILE_FORMAT_VERSION = 1; @@ -138,7 +138,7 @@ void InstanceList::saveGroupList() if (!groupFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { // An error occurred. Ignore it. - QLOG_ERROR() << "Failed to save instance group file."; + qCritical() << "Failed to save instance group file."; return; } QTextStream out(&groupFile); @@ -202,7 +202,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap) if (!groupFile.open(QIODevice::ReadOnly)) { // An error occurred. Ignore it. - QLOG_ERROR() << "Failed to read instance group file."; + qCritical() << "Failed to read instance group file."; return; } @@ -216,7 +216,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap) // if the json was bad, fail 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)) .toUtf8(); return; @@ -225,7 +225,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap) // if the root of the json wasn't an object, fail 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; } @@ -238,7 +238,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap) // Get the groups. if it's not an object, fail 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; } @@ -251,7 +251,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap) // If not an object, complain and skip to the next one. 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.") .arg(groupName) .toUtf8(); @@ -261,7 +261,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap) QJsonObject groupObj = iter.value().toObject(); 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 " "called 'instances'.") .arg(groupName) @@ -298,7 +298,7 @@ InstanceList::InstListError InstanceList::loadList() QString subDir = iter.next(); if (!QFileInfo(PathCombine(subDir, "instance.cfg")).exists()) continue; - QLOG_INFO() << "Loading MultiMC instance from " << subDir; + qDebug() << "Loading MultiMC instance from " << subDir; InstancePtr instPtr; auto error = loadInstance(instPtr, subDir); 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); break; } - QLOG_ERROR() << errorMsg.toUtf8(); + qCritical() << errorMsg.toUtf8(); return false; } 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()) .toUtf8(); return false; @@ -427,7 +427,7 @@ bool InstanceList::continueProcessInstance(InstancePtr instPtr, const int error, { instPtr->setGroupInitial((*iter)); } - QLOG_INFO() << "Loaded instance " << instPtr->name() << " from " << dir.absolutePath(); + qDebug() << "Loaded instance " << instPtr->name() << " from " << dir.absolutePath(); return true; } } @@ -463,16 +463,16 @@ InstanceList::createInstance(InstancePtr &inst, BaseVersionPtr version, const QS { QDir rootDir(instDir); - QLOG_DEBUG() << instDir.toUtf8(); + qDebug() << instDir.toUtf8(); if (!rootDir.exists() && !rootDir.mkpath(".")) { - QLOG_ERROR() << "Can't create instance folder" << instDir; + qCritical() << "Can't create instance folder" << instDir; return InstanceList::CantCreateDir; } 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; } @@ -497,7 +497,7 @@ InstanceList::copyInstance(InstancePtr &newInstance, InstancePtr &oldInstance, c { QDir rootDir(instDir); - QLOG_DEBUG() << instDir.toUtf8(); + qDebug() << instDir.toUtf8(); if (!copyPath(oldInstance->instanceRoot(), instDir)) { rootDir.removeRecursively(); diff --git a/logic/JarUtils.cpp b/logic/JarUtils.cpp index d4f1ed56..e73af53c 100644 --- a/logic/JarUtils.cpp +++ b/logic/JarUtils.cpp @@ -2,7 +2,7 @@ #include <quazip.h> #include <quazipfile.h> #include <JlCompress.h> -#include <logger/QsLog.h> +#include <QDebug> namespace JarUtils { @@ -19,13 +19,13 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained, QString filename = modZip.getCurrentFileName(); if (!filter(filename)) { - QLOG_INFO() << "Skipping file " << filename << " from " + qDebug() << "Skipping file " << filename << " from " << from.fileName() << " - filtered"; continue; } if (contained.contains(filename)) { - QLOG_INFO() << "Skipping already contained file " << filename << " from " + qDebug() << "Skipping already contained file " << filename << " from " << from.fileName(); continue; } @@ -33,7 +33,7 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained, if (!fileInsideMod.open(QIODevice::ReadOnly)) { - QLOG_ERROR() << "Failed to open " << filename << " from " << from.fileName(); + qCritical() << "Failed to open " << filename << " from " << from.fileName(); return false; } @@ -41,7 +41,7 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained, 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(); return false; } @@ -49,7 +49,7 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained, { zipOutFile.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; } zipOutFile.close(); @@ -64,7 +64,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M if (!zipOut.open(QuaZip::mdCreate)) { QFile::remove(targetJarPath); - QLOG_ERROR() << "Failed to open the minecraft.jar for modding"; + qCritical() << "Failed to open the minecraft.jar for modding"; return false; } // Files already added to the jar. @@ -86,7 +86,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M { zipOut.close(); 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; } } @@ -98,7 +98,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M { zipOut.close(); 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; } addedFiles.insert(filename.fileName()); @@ -114,10 +114,10 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M { zipOut.close(); 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; } - QLOG_INFO() << "Adding folder " << filename.fileName() << " from " + qDebug() << "Adding folder " << filename.fileName() << " from " << filename.absoluteFilePath(); } } @@ -126,7 +126,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M { zipOut.close(); QFile::remove(targetJarPath); - QLOG_ERROR() << "Failed to insert minecraft.jar contents."; + qCritical() << "Failed to insert minecraft.jar contents."; return false; } @@ -135,7 +135,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList<M if (zipOut.getZipError() != 0) { QFile::remove(targetJarPath); - QLOG_ERROR() << "Failed to finalize minecraft.jar!"; + qCritical() << "Failed to finalize minecraft.jar!"; return false; } return true; diff --git a/logic/LegacyInstance.cpp b/logic/LegacyInstance.cpp index 11566866..1d4d6150 100644 --- a/logic/LegacyInstance.cpp +++ b/logic/LegacyInstance.cpp @@ -191,7 +191,7 @@ QList<Mod> LegacyInstance::getJarMods() const 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); } diff --git a/logic/LegacyUpdate.cpp b/logic/LegacyUpdate.cpp index e12556eb..8b970f08 100644 --- a/logic/LegacyUpdate.cpp +++ b/logic/LegacyUpdate.cpp @@ -28,7 +28,7 @@ #include "logic/Env.h" #include "logic/ModList.h" -#include "logger/QsLog.h" +#include <QDebug> #include "logic/net/URLConstants.h" #include "JarUtils.h" diff --git a/logic/LwjglVersionList.cpp b/logic/LwjglVersionList.cpp index 5bd9faa2..9e101b74 100644 --- a/logic/LwjglVersionList.cpp +++ b/logic/LwjglVersionList.cpp @@ -20,7 +20,7 @@ #include <QtXml> #include <QRegExp> -#include "logger/QsLog.h" +#include <QDebug> #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"); 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; } @@ -147,10 +147,10 @@ void LWJGLVersionList::netRequestComplete() QUrl url(link); if (!url.isValid()) { - QLOG_WARN() << "LWJGL version URL isn't valid:" << link << "Skipping."; + qWarning() << "LWJGL version URL isn't valid:" << link << "Skipping."; continue; } - QLOG_INFO() << "Discovered LWGL version" << name << "at" << link; + qDebug() << "Discovered LWGL version" << name << "at" << link; tempList.append(std::make_shared<LWJGLVersion>(name, link)); } } @@ -159,7 +159,7 @@ void LWJGLVersionList::netRequestComplete() m_vlist.swap(tempList); endResetModel(); - QLOG_INFO() << "Loaded LWJGL list."; + qDebug() << "Loaded LWJGL list."; finished(); } else @@ -173,7 +173,7 @@ void LWJGLVersionList::netRequestComplete() void LWJGLVersionList::failed(QString msg) { - QLOG_ERROR() << msg; + qCritical() << msg; emit loadListFailed(msg); } diff --git a/logic/Mod.cpp b/logic/Mod.cpp index 7fdd2a5e..7fa4905e 100644 --- a/logic/Mod.cpp +++ b/logic/Mod.cpp @@ -25,7 +25,7 @@ #include "Mod.h" #include <pathutils.h> #include "logic/settings/INIFile.h" -#include "logger/QsLog.h" +#include <QDebug> Mod::Mod(const QFileInfo &file) { @@ -209,8 +209,8 @@ void Mod::ReadMCModInfo(QByteArray contents) int version = val.toDouble(); if (version != 2) { - QLOG_ERROR() << "BAD stuff happened to mod json:"; - QLOG_ERROR() << contents; + qCritical() << "BAD stuff happened to mod json:"; + qCritical() << contents; return; } 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) { - 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()); } if (t == MOD_FOLDER) diff --git a/logic/ModList.cpp b/logic/ModList.cpp index f6037c95..68d74e79 100644 --- a/logic/ModList.cpp +++ b/logic/ModList.cpp @@ -21,7 +21,7 @@ #include <QUuid> #include <QString> #include <QFileSystemWatcher> -#include "logger/QsLog.h" +#include <QDebug> ModList::ModList(const QString &dir, const QString &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()); if (is_watching) { - QLOG_INFO() << "Started watching " << m_dir.absolutePath(); + qDebug() << "Started watching " << m_dir.absolutePath(); } 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()); if (!is_watching) { - QLOG_INFO() << "Stopped watching " << m_dir.absolutePath(); + qDebug() << "Stopped watching " << m_dir.absolutePath(); } 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(); if (orderOrStateChanged && !m_list_file.isEmpty()) { - QLOG_INFO() << "Mod list " << m_list_file << " changed!"; + qDebug() << "Mod list " << m_list_file << " changed!"; saveListFile(); emit changed(); } @@ -559,7 +559,7 @@ bool ModList::dropMimeData(const QMimeData *data, Qt::DropAction action, int row row = rowCount(); if (column == -1) column = 0; - QLOG_INFO() << "Drop row: " << row << " column: " << column; + qDebug() << "Drop row: " << row << " column: " << column; // files dropped from outside? if (data->hasUrls()) @@ -575,7 +575,7 @@ bool ModList::dropMimeData(const QMimeData *data, Qt::DropAction action, int row continue; QString filename = url.toLocalFile(); installMod(filename, row); - QLOG_INFO() << "installing: " << filename; + qDebug() << "installing: " << filename; // if there is no ordering, re-sort the list if (m_list_file.isEmpty()) { @@ -596,7 +596,7 @@ bool ModList::dropMimeData(const QMimeData *data, Qt::DropAction action, int row return false; QString remoteId = list[0]; int remoteIndex = list[1].toInt(); - QLOG_INFO() << "move: " << sourcestr; + qDebug() << "move: " << sourcestr; // no moving of things between two lists if (remoteId != m_list_id) return false; diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp index bdd47131..642a6aec 100644 --- a/logic/OneSixInstance.cpp +++ b/logic/OneSixInstance.cpp @@ -15,7 +15,7 @@ #include <QIcon> #include <pathutils.h> -#include "logger/QsLog.h" +#include <QDebug> #include "MMCError.h" #include "logic/OneSixInstance.h" diff --git a/logic/OneSixUpdate.cpp b/logic/OneSixUpdate.cpp index 38e9c0d7..5ec36305 100644 --- a/logic/OneSixUpdate.cpp +++ b/logic/OneSixUpdate.cpp @@ -60,14 +60,14 @@ void OneSixUpdate::executeTask() } 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(); return; } versionUpdateTask = std::dynamic_pointer_cast<MinecraftVersionList>(ENV.getVersionList("net.minecraft"))->createUpdateTask(m_inst->intendedVersionId()); if (!versionUpdateTask) { - QLOG_DEBUG() << "Didn't spawn an update task."; + qDebug() << "Didn't spawn an update task."; jarlibStart(); return; } @@ -173,7 +173,7 @@ void OneSixUpdate::assetsFailed() void OneSixUpdate::jarlibStart() { 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; try { diff --git a/logic/assets/AssetsUtils.cpp b/logic/assets/AssetsUtils.cpp index 82a0da95..9f33b1bd 100644 --- a/logic/assets/AssetsUtils.cpp +++ b/logic/assets/AssetsUtils.cpp @@ -20,7 +20,7 @@ #include <QJsonDocument> #include <QJsonObject> #include <QVariant> -#include <logger/QsLog.h> +#include <QDebug> #include "AssetsUtils.h" #include <pathutils.h> @@ -85,7 +85,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index) // TODO: We should probably report this error to the user. if (!file.open(QIODevice::ReadOnly)) { - QLOG_ERROR() << "Failed to read assets index file" << path; + qCritical() << "Failed to read assets index file" << path; return false; } @@ -99,7 +99,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index) // Fail if the JSON is invalid. 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); return false; } @@ -107,7 +107,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index) // Make sure the root is an object. 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; } @@ -124,7 +124,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index) for (QVariantMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) { - // QLOG_DEBUG() << iter.key(); + // qDebug() << iter.key(); QVariant variant = iter.value(); QVariantMap nested_objects = variant.toMap(); @@ -134,7 +134,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index) for (QVariantMap::const_iterator nested_iter = nested_objects.begin(); 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(); QVariant value = nested_iter.value(); @@ -167,11 +167,11 @@ QDir reconstructAssets(QString assetsId) 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; } - QLOG_DEBUG() << "reconstructAssets" << assetsDir.path() << indexDir.path() + qDebug() << "reconstructAssets" << assetsDir.path() << indexDir.path() << objectDir.path() << virtualDir.path() << virtualRoot.path(); AssetsIndex index; @@ -179,7 +179,7 @@ QDir reconstructAssets(QString assetsId) 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()) { @@ -198,12 +198,12 @@ QDir reconstructAssets(QString assetsId) { QFileInfo info(target_path); QDir target_dir = info.dir(); - // QLOG_DEBUG() << target_dir; + // qDebug() << target_dir; if (!target_dir.exists()) QDir("").mkpath(target_dir.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(); } } diff --git a/logic/auth/MojangAccount.cpp b/logic/auth/MojangAccount.cpp index 19c56ae6..69a24c09 100644 --- a/logic/auth/MojangAccount.cpp +++ b/logic/auth/MojangAccount.cpp @@ -26,14 +26,14 @@ #include <QStringList> #include <QJsonDocument> -#include <logger/QsLog.h> +#include <QDebug> MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object) { // The JSON object must at least have a username for it to be valid. 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."; return nullptr; } @@ -45,7 +45,7 @@ MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object) QJsonArray profileArray = object.value("profiles").toArray(); 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."; return nullptr; } @@ -59,7 +59,7 @@ MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object) bool legacy = profileObject.value("legacy").toBool(false); 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; } profiles.append({id, name, legacy}); diff --git a/logic/auth/MojangAccountList.cpp b/logic/auth/MojangAccountList.cpp index 94cdf8b5..abed9b24 100644 --- a/logic/auth/MojangAccountList.cpp +++ b/logic/auth/MojangAccountList.cpp @@ -24,7 +24,7 @@ #include <QJsonParseError> #include <QDir> -#include "logger/QsLog.h" +#include <QDebug> #include "logic/auth/MojangAccount.h" #include <pathutils.h> @@ -262,7 +262,7 @@ bool MojangAccountList::loadList(const QString &filePath) path = m_listFilePath; 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; } @@ -272,7 +272,7 @@ bool MojangAccountList::loadList(const QString &filePath) // TODO: We should probably report this error to the user. 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; } @@ -286,7 +286,7 @@ bool MojangAccountList::loadList(const QString &filePath) // Fail if the JSON is invalid. 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)) .toUtf8(); return false; @@ -295,7 +295,7 @@ bool MojangAccountList::loadList(const QString &filePath) // Make sure the root is an object. 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; } @@ -305,7 +305,7 @@ bool MojangAccountList::loadList(const QString &filePath) if (root.value("formatVersion").toVariant().toInt() != ACCOUNT_LIST_FORMAT_VERSION) { 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; // Attempt to rename the old version. @@ -327,7 +327,7 @@ bool MojangAccountList::loadList(const QString &filePath) } else { - QLOG_WARN() << "Failed to load an account."; + qWarning() << "Failed to load an account."; } } // Load the active account. @@ -343,7 +343,7 @@ bool MojangAccountList::saveList(const QString &filePath) path = m_listFilePath; 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; } @@ -359,16 +359,16 @@ bool MojangAccountList::saveList(const QString &filePath) 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. QJsonObject root; root.insert("formatVersion", ACCOUNT_LIST_FORMAT_VERSION); // Build a list of accounts. - QLOG_DEBUG() << "Building account array."; + qDebug() << "Building account array."; QJsonArray accounts; for (MojangAccountPtr account : m_accounts) { @@ -389,14 +389,14 @@ bool MojangAccountList::saveList(const QString &filePath) QJsonDocument doc(root); // 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); // Try to open the file and fail if we can't. // TODO: We should probably report this error to the user. 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; } @@ -405,7 +405,7 @@ bool MojangAccountList::saveList(const QString &filePath) file.setPermissions(QFile::ReadOwner|QFile::WriteOwner|QFile::ReadUser|QFile::WriteUser); file.close(); - QLOG_INFO() << "Saved account list to" << path; + qDebug() << "Saved account list to" << path; return true; } diff --git a/logic/auth/YggdrasilTask.cpp b/logic/auth/YggdrasilTask.cpp index 6b5ed256..4d5c2594 100644 --- a/logic/auth/YggdrasilTask.cpp +++ b/logic/auth/YggdrasilTask.cpp @@ -26,7 +26,7 @@ #include <logic/auth/MojangAccount.h> #include <logic/net/URLConstants.h> -#include "logger/QsLog.h" +#include <QDebug> YggdrasilTask::YggdrasilTask(MojangAccount *account, QObject *parent) : Task(parent), m_account(account) @@ -94,9 +94,9 @@ void YggdrasilTask::sslErrors(QList<QSslError> errors) int i = 1; for (auto error : errors) { - QLOG_ERROR() << "LOGIN SSL Error #" << i << " : " << error.errorString(); + qCritical() << "LOGIN SSL Error #" << i << " : " << error.errorString(); auto cert = error.certificate(); - QLOG_ERROR() << "Certificate in question:\n" << cert.toText(); + qCritical() << "Certificate in question:\n" << cert.toText(); i++; } } @@ -163,7 +163,7 @@ void YggdrasilTask::processReply() "JSON response: %1 at offset %2.") .arg(jsonError.errorString()) .arg(jsonError.offset)); - QLOG_ERROR() << replyData; + qCritical() << replyData; } return; } @@ -177,7 +177,7 @@ void YggdrasilTask::processReply() // We were able to parse the server's response. Woo! // Call processError. If a subclass has overridden it then they'll handle their // 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."; processError(doc.object()); } @@ -185,7 +185,7 @@ void YggdrasilTask::processReply() { // The server didn't say anything regarding the error. Give the user an unknown // error. - QLOG_DEBUG() + qDebug() << "The request failed and the server gave no error message. Unknown error."; changeState(STATE_FAILED_SOFT, tr("An unknown error occurred when trying to communicate with the " diff --git a/logic/auth/flows/AuthenticateTask.cpp b/logic/auth/flows/AuthenticateTask.cpp index ed8c52fb..4141f00d 100644 --- a/logic/auth/flows/AuthenticateTask.cpp +++ b/logic/auth/flows/AuthenticateTask.cpp @@ -23,7 +23,7 @@ #include <QJsonArray> #include <QVariant> -#include "logger/QsLog.h" +#include <QDebug> AuthenticateTask::AuthenticateTask(MojangAccount * account, const QString &password, 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 // profile. - QLOG_DEBUG() << "Processing authentication response."; - // QLOG_DEBUG() << responseData; + qDebug() << "Processing authentication response."; + // qDebug() << responseData; // If we already have a client token, make sure the one the server gave us matches our // existing one. - QLOG_DEBUG() << "Getting client token."; + qDebug() << "Getting client token."; QString clientToken = responseData.value("clientToken").toString(""); if (clientToken.isEmpty()) { @@ -95,7 +95,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData) m_account->m_clientToken = clientToken; // Now, we set the access token. - QLOG_DEBUG() << "Getting access token."; + qDebug() << "Getting access token."; QString accessToken = responseData.value("accessToken").toString(""); if (accessToken.isEmpty()) { @@ -110,7 +110,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData) // Mojang hasn't yet implemented the profile system, // but we might as well support what's there so we // don't have trouble implementing it later. - QLOG_DEBUG() << "Loading profile list."; + qDebug() << "Loading profile list."; QJsonArray availableProfiles = responseData.value("availableProfiles").toArray(); QList<AccountProfile> loadedProfiles; for (auto iter : availableProfiles) @@ -126,7 +126,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData) // This should never happen, but we might as well // warn about it if it does so we can debug it easily. // 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."; } @@ -140,7 +140,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData) // We do need to make sure that the current profile that the server gave us // is actually in the available profiles list. // 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(); QString currentProfileId = currentProfile.value("id").toString(""); 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 succeeded. - QLOG_DEBUG() << "Finished reading authentication response."; + qDebug() << "Finished reading authentication response."; changeState(STATE_SUCCEEDED); } diff --git a/logic/auth/flows/RefreshTask.cpp b/logic/auth/flows/RefreshTask.cpp index 4ca73b21..2216c7e4 100644 --- a/logic/auth/flows/RefreshTask.cpp +++ b/logic/auth/flows/RefreshTask.cpp @@ -22,7 +22,7 @@ #include <QJsonArray> #include <QVariant> -#include "logger/QsLog.h" +#include <QDebug> 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 // 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 // existing one. QString clientToken = responseData.value("clientToken").toString(""); @@ -82,7 +82,7 @@ void RefreshTask::processResponse(QJsonObject responseData) } // Now, we set the access token. - QLOG_DEBUG() << "Getting new access token."; + qDebug() << "Getting new access token."; QString accessToken = responseData.value("accessToken").toString(""); 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 succeeded. - QLOG_DEBUG() << "Finished reading refresh response."; + qDebug() << "Finished reading refresh response."; // Reset the access token. m_account->m_accessToken = accessToken; changeState(STATE_SUCCEEDED); diff --git a/logic/auth/flows/ValidateTask.cpp b/logic/auth/flows/ValidateTask.cpp index f3a8a23e..21afb596 100644 --- a/logic/auth/flows/ValidateTask.cpp +++ b/logic/auth/flows/ValidateTask.cpp @@ -23,7 +23,7 @@ #include <QJsonArray> #include <QVariant> -#include "logger/QsLog.h" +#include <QDebug> ValidateTask::ValidateTask(MojangAccount * account, QObject *parent) : YggdrasilTask(account, parent) diff --git a/logic/forge/ForgeInstaller.cpp b/logic/forge/ForgeInstaller.cpp index 19cecaeb..b6fb426a 100644 --- a/logic/forge/ForgeInstaller.cpp +++ b/logic/forge/ForgeInstaller.cpp @@ -181,7 +181,7 @@ bool ForgeInstaller::add(OneSixInstance *to) // mark bad libraries based on the xzlist above for (auto entry : xzlist) { - QLOG_DEBUG() << "Testing " << rawName << " : " << entry; + qDebug() << "Testing " << rawName << " : " << entry; if (rawName.startsWith(entry)) { lib->setHint("forge-pack-xz"); @@ -260,7 +260,7 @@ bool ForgeInstaller::add(OneSixInstance *to) QFile file(filename(to->instanceRoot())); if (!file.open(QFile::WriteOnly)) { - QLOG_ERROR() << "Error opening" << file.fileName() + qCritical() << "Error opening" << file.fileName() << "for reading:" << file.errorString(); return false; } @@ -314,7 +314,7 @@ bool ForgeInstaller::addLegacy(OneSixInstance *to) QFile file(filename(to->instanceRoot())); if (!file.open(QFile::WriteOnly)) { - QLOG_ERROR() << "Error opening" << file.fileName() + qCritical() << "Error opening" << file.fileName() << "for reading:" << file.errorString(); return false; } @@ -352,7 +352,7 @@ protected: { if (!install(entry, forgeVersion)) { - QLOG_ERROR() << "Failure installing forge"; + qCritical() << "Failure installing forge"; emitFailed(tr("Failure to install forge")); } else diff --git a/logic/forge/ForgeMirrors.cpp b/logic/forge/ForgeMirrors.cpp index bb50d0b7..06abb88f 100644 --- a/logic/forge/ForgeMirrors.cpp +++ b/logic/forge/ForgeMirrors.cpp @@ -1,6 +1,6 @@ #include "logic/Env.h" #include "ForgeMirrors.h" -#include "logger/QsLog.h" +#include <QDebug> #include <algorithm> #include <random> @@ -15,7 +15,7 @@ ForgeMirrors::ForgeMirrors(QList<ForgeXzDownloadPtr> &libs, NetJobPtr parent_job void ForgeMirrors::start() { - QLOG_INFO() << "Downloading " << m_url.toString(); + qDebug() << "Downloading " << m_url.toString(); QNetworkRequest request(m_url); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); auto worker = ENV.qnam(); @@ -33,7 +33,7 @@ void ForgeMirrors::start() void ForgeMirrors::downloadError(QNetworkReply::NetworkError error) { // error happened during download. - QLOG_ERROR() << "Error getting URL:" << m_url.toString().toLocal8Bit() + qCritical() << "Error getting URL:" << m_url.toString().toLocal8Bit() << "Network error: " << error; m_status = Job_Failed; } diff --git a/logic/forge/ForgeVersionList.cpp b/logic/forge/ForgeVersionList.cpp index d7bb8af2..260f84eb 100644 --- a/logic/forge/ForgeVersionList.cpp +++ b/logic/forge/ForgeVersionList.cpp @@ -23,7 +23,7 @@ #include <QtXml> #include <QRegExp> -#include "logger/QsLog.h" +#include <QDebug> ForgeVersionList::ForgeVersionList(QObject *parent) : BaseVersionList(parent) { @@ -338,7 +338,7 @@ bool ForgeListLoadTask::parseForgeGradleList(QList<BaseVersionPtr> &out) fVersion->m_buildnr = number.value("build").toDouble(); 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->branch = number.value("branch").toString(""); @@ -437,11 +437,11 @@ void ForgeListLoadTask::listFailed() auto reply = listDownload->m_reply; if (reply) { - QLOG_ERROR() << "Getting forge version list failed: " << reply->errorString(); + qCritical() << "Getting forge version list failed: " << reply->errorString(); } 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; if (reply) { - QLOG_ERROR() << "Getting forge version list failed: " << reply->errorString(); + qCritical() << "Getting forge version list failed: " << reply->errorString(); } else { - QLOG_ERROR() << "Getting forge version list failed for reasons unknown."; + qCritical() << "Getting forge version list failed for reasons unknown."; } } diff --git a/logic/forge/ForgeXzDownload.cpp b/logic/forge/ForgeXzDownload.cpp index c2e5f76e..ac2c4b1f 100644 --- a/logic/forge/ForgeXzDownload.cpp +++ b/logic/forge/ForgeXzDownload.cpp @@ -21,7 +21,7 @@ #include <QFileInfo> #include <QDateTime> #include <QDir> -#include "logger/QsLog.h" +#include <QDebug> ForgeXzDownload::ForgeXzDownload(QString relative_path, MetaEntryPtr entry) : NetAction() { @@ -62,7 +62,7 @@ void ForgeXzDownload::start() return; } - QLOG_INFO() << "Downloading " << m_url.toString(); + qDebug() << "Downloading " << m_url.toString(); QNetworkRequest request(m_url); request.setRawHeader(QString("If-None-Match").toLatin1(), m_entry->etag.toLatin1()); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Cached)"); @@ -108,10 +108,10 @@ void ForgeXzDownload::failAndTryNextMirror() void ForgeXzDownload::updateUrl() { - QLOG_INFO() << "Updating URL for " << m_url_path; + qDebug() << "Updating URL for " << m_url_path; 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"; m_url = QUrl(aggregate); @@ -121,10 +121,10 @@ void ForgeXzDownload::downloadFinished() { //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) { - QLOG_INFO() <<"dl " << index_within_job << " AUTOFAIL"; + qDebug() <<"dl " << index_within_job << " AUTOFAIL"; m_status = Job_Failed; m_pack200_xz_file.close(); m_pack200_xz_file.remove(); @@ -270,38 +270,38 @@ void ForgeXzDownload::decompressAndInstall() break; case XZ_MEM_ERROR: - QLOG_ERROR() << "Memory allocation failed\n"; + qCritical() << "Memory allocation failed\n"; xz_dec_end(s); failAndTryNextMirror(); return; case XZ_MEMLIMIT_ERROR: - QLOG_ERROR() << "Memory usage limit reached\n"; + qCritical() << "Memory usage limit reached\n"; xz_dec_end(s); failAndTryNextMirror(); return; case XZ_FORMAT_ERROR: - QLOG_ERROR() << "Not a .xz file\n"; + qCritical() << "Not a .xz file\n"; xz_dec_end(s); failAndTryNextMirror(); return; 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); failAndTryNextMirror(); return; case XZ_DATA_ERROR: case XZ_BUF_ERROR: - QLOG_ERROR() << "File is corrupt\n"; + qCritical() << "File is corrupt\n"; xz_dec_end(s); failAndTryNextMirror(); return; default: - QLOG_ERROR() << "Bug!\n"; + qCritical() << "Bug!\n"; xz_dec_end(s); failAndTryNextMirror(); return; @@ -316,35 +316,35 @@ void ForgeXzDownload::decompressAndInstall() // FIXME: dispose of file handles, pointers and the like. Ideally wrap in objects. if(handle_in == -1) { - QLOG_ERROR() << "Error reopening " << pack200_file.fileName(); + qCritical() << "Error reopening " << pack200_file.fileName(); failAndTryNextMirror(); return; } FILE * file_in = fdopen(handle_in,"r"); if(!file_in) { - QLOG_ERROR() << "Error reopening " << pack200_file.fileName(); + qCritical() << "Error reopening " << pack200_file.fileName(); failAndTryNextMirror(); return; } QFile qfile_out(m_target_path); if(!qfile_out.open(QIODevice::WriteOnly)) { - QLOG_ERROR() << "Error opening " << qfile_out.fileName(); + qCritical() << "Error opening " << qfile_out.fileName(); failAndTryNextMirror(); return; } int handle_out = qfile_out.handle(); if(handle_out == -1) { - QLOG_ERROR() << "Error opening " << qfile_out.fileName(); + qCritical() << "Error opening " << qfile_out.fileName(); failAndTryNextMirror(); return; } FILE * file_out = fdopen(handle_out,"w"); if(!file_out) { - QLOG_ERROR() << "Error opening " << qfile_out.fileName(); + qCritical() << "Error opening " << qfile_out.fileName(); failAndTryNextMirror(); return; } @@ -355,7 +355,7 @@ void ForgeXzDownload::decompressAndInstall() catch (std::runtime_error &err) { 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); if (f.exists()) f.remove(); diff --git a/logic/ftb/FTBProfileStrategy.cpp b/logic/ftb/FTBProfileStrategy.cpp index d5b3c90f..87be0ff9 100644 --- a/logic/ftb/FTBProfileStrategy.cpp +++ b/logic/ftb/FTBProfileStrategy.cpp @@ -106,10 +106,10 @@ void FTBProfileStrategy::loadUserPatches() QFileInfo finfo(filename); if(!finfo.exists()) { - QLOG_INFO() << "Patch file " << filename << " was deleted by external means..."; + qDebug() << "Patch file " << filename << " was deleted by external means..."; continue; } - QLOG_INFO() << "Reading" << filename << "by user order"; + qDebug() << "Reading" << filename << "by user order"; auto file = ProfileUtils::parseJsonFile(finfo, false); // sanity check. prevent tampering with files. if (file->fileId != id) @@ -124,7 +124,7 @@ void FTBProfileStrategy::loadUserPatches() for (auto info : patches.entryInfoList(QStringList() << "*.json", QDir::Files)) { // parse the file - QLOG_INFO() << "Reading" << info.fileName(); + qDebug() << "Reading" << info.fileName(); auto file = ProfileUtils::parseJsonFile(info, true); // ignore builtins if (file->fileId == "net.minecraft") diff --git a/logic/ftb/OneSixFTBInstance.cpp b/logic/ftb/OneSixFTBInstance.cpp index 4de2ce78..4902be08 100644 --- a/logic/ftb/OneSixFTBInstance.cpp +++ b/logic/ftb/OneSixFTBInstance.cpp @@ -21,11 +21,11 @@ void OneSixFTBInstance::copy(const QDir &newDir) QStringList libraryNames; // create patch file { - QLOG_DEBUG() << "Creating patch file for FTB instance..."; + qDebug()<< "Creating patch file for FTB instance..."; QFile f(minecraftRoot() + "/pack.json"); if (!f.open(QFile::ReadOnly)) { - QLOG_ERROR() << "Couldn't open" << f.fileName() << ":" << f.errorString(); + qCritical() << "Couldn't open" << f.fileName() << ":" << f.errorString(); return; } QJsonObject root = QJsonDocument::fromJson(f.readAll()).object(); @@ -68,14 +68,14 @@ void OneSixFTBInstance::copy(const QDir &newDir) QFile out(newDir.absoluteFilePath("patches/ftb.json")); 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; } out.write(QJsonDocument(root).toJson()); } // copy libraries { - QLOG_DEBUG() << "Copying FTB libraries"; + qDebug() << "Copying FTB libraries"; for (auto library : libraryNames) { OneSixLibrary *lib = new OneSixLibrary(library); @@ -86,11 +86,11 @@ void OneSixFTBInstance::copy(const QDir &newDir) } 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)) { - QLOG_ERROR() << "Couldn't copy" << lib->rawName(); + qCritical() << "Couldn't copy" << lib->rawName(); } } } diff --git a/logic/icons/IconList.cpp b/logic/icons/IconList.cpp index 964d61e9..40949392 100644 --- a/logic/icons/IconList.cpp +++ b/logic/icons/IconList.cpp @@ -21,7 +21,7 @@ #include <QUrl> #include <QFileSystemWatcher> #include <QSet> -#include <logger/QsLog.h> +#include <QDebug> #define MAX_SIZE 1024 @@ -84,7 +84,7 @@ void IconList::directoryChanged(const QString &path) for (auto remove : to_remove) { - QLOG_INFO() << "Removing " << remove; + qDebug() << "Removing " << remove; QFileInfo rmfile(remove); QString key = rmfile.baseName(); int idx = getIconIndex(key); @@ -108,7 +108,7 @@ void IconList::directoryChanged(const QString &path) for (auto add : to_add) { - QLOG_INFO() << "Adding " << add; + qDebug() << "Adding " << add; QFileInfo addfile(add); QString key = addfile.baseName(); if (addIcon(key, QString(), addfile.filePath(), MMCIcon::FileBased)) @@ -121,7 +121,7 @@ void IconList::directoryChanged(const QString &path) void IconList::fileChanged(const QString &path) { - QLOG_INFO() << "Checking " << path; + qDebug() << "Checking " << path; QFileInfo checkfile(path); if (!checkfile.exists()) return; @@ -153,11 +153,11 @@ void IconList::startWatching() is_watching = m_watcher->addPath(abs_path); if (is_watching) { - QLOG_INFO() << "Started watching " << abs_path; + qDebug() << "Started watching " << abs_path; } else { - QLOG_INFO() << "Failed to start watching " << abs_path; + qDebug() << "Failed to start watching " << abs_path; } } diff --git a/logic/java/JavaCheckerJob.cpp b/logic/java/JavaCheckerJob.cpp index 8fd423c1..149024c0 100644 --- a/logic/java/JavaCheckerJob.cpp +++ b/logic/java/JavaCheckerJob.cpp @@ -16,12 +16,12 @@ #include "JavaCheckerJob.h" #include "pathutils.h" -#include "logger/QsLog.h" +#include <QDebug> void JavaCheckerJob::partFinished(JavaCheckResult result) { num_finished++; - QLOG_INFO() << m_job_name.toLocal8Bit() << "progress:" << num_finished << "/" + qDebug() << m_job_name.toLocal8Bit() << "progress:" << num_finished << "/" << javacheckers.size(); emit progress(num_finished, javacheckers.size()); @@ -35,7 +35,7 @@ void JavaCheckerJob::partFinished(JavaCheckResult result) void JavaCheckerJob::start() { - QLOG_INFO() << m_job_name.toLocal8Bit() << " started."; + qDebug() << m_job_name.toLocal8Bit() << " started."; m_running = true; for (auto iter : javacheckers) { diff --git a/logic/java/JavaUtils.cpp b/logic/java/JavaUtils.cpp index a522f45c..3cacbbd2 100644 --- a/logic/java/JavaUtils.cpp +++ b/logic/java/JavaUtils.cpp @@ -21,7 +21,7 @@ #include <logic/settings/Setting.h> #include <pathutils.h> -#include "logger/QsLog.h" +#include <QDebug> #include "logic/java/JavaUtils.h" #include "logic/java/JavaCheckerJob.h" #include "logic/java/JavaVersionList.h" @@ -197,7 +197,7 @@ QList<QString> JavaUtils::FindJavaPaths() #elif LINUX QList<QString> JavaUtils::FindJavaPaths() { - QLOG_INFO() << "Linux Java detection incomplete - defaulting to \"java\""; + qDebug() << "Linux Java detection incomplete - defaulting to \"java\""; QList<QString> javas; javas.append(this->GetDefaultJava()->path); @@ -209,7 +209,7 @@ QList<QString> JavaUtils::FindJavaPaths() #else QList<QString> JavaUtils::FindJavaPaths() { - QLOG_INFO() << "Unknown operating system build - defaulting to \"java\""; + qDebug() << "Unknown operating system build - defaulting to \"java\""; QList<QString> javas; javas.append(this->GetDefaultJava()->path); diff --git a/logic/java/JavaVersionList.cpp b/logic/java/JavaVersionList.cpp index 73e8259a..4f8592ce 100644 --- a/logic/java/JavaVersionList.cpp +++ b/logic/java/JavaVersionList.cpp @@ -17,7 +17,7 @@ #include <QtXml> #include <QRegExp> -#include "logger/QsLog.h" +#include <QDebug> #include "logic/java/JavaVersionList.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(progress(int, int)), this, SLOT(checkerProgress(int, int))); - QLOG_DEBUG() << "Probing the following Java paths: "; + qDebug() << "Probing the following Java paths: "; int id = 0; for(QString candidate : candidate_paths) { - QLOG_DEBUG() << " " << candidate; + qDebug() << " " << candidate; auto candidate_checker = new JavaChecker(); candidate_checker->path = candidate; @@ -207,7 +207,7 @@ void JavaListLoadTask::javaCheckerFinished(QList<JavaCheckResult> results) { QList<JavaVersionPtr> candidates; - QLOG_DEBUG() << "Found the following valid Java installations:"; + qDebug() << "Found the following valid Java installations:"; for(JavaCheckResult result : results) { if(result.valid) @@ -219,14 +219,14 @@ void JavaListLoadTask::javaCheckerFinished(QList<JavaCheckResult> results) javaVersion->path = result.path; candidates.append(javaVersion); - QLOG_DEBUG() << " " << javaVersion->id << javaVersion->arch << javaVersion->path; + qDebug() << " " << javaVersion->id << javaVersion->arch << javaVersion->path; } } QList<BaseVersionPtr> javas_bvp; 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); if (bp_java) diff --git a/logic/liteloader/LiteLoaderInstaller.cpp b/logic/liteloader/LiteLoaderInstaller.cpp index a2728499..b105be08 100644 --- a/logic/liteloader/LiteLoaderInstaller.cpp +++ b/logic/liteloader/LiteLoaderInstaller.cpp @@ -18,7 +18,7 @@ #include <QJsonArray> #include <QJsonDocument> -#include "logger/QsLog.h" +#include <QDebug> #include "logic/minecraft/MinecraftProfile.h" #include "logic/minecraft/OneSixLibrary.h" @@ -76,7 +76,7 @@ bool LiteLoaderInstaller::add(OneSixInstance *to) QFile file(filename(to->instanceRoot())); if (!file.open(QFile::WriteOnly)) { - QLOG_ERROR() << "Error opening" << file.fileName() + qCritical() << "Error opening" << file.fileName() << "for reading:" << file.errorString(); return false; } diff --git a/logic/liteloader/LiteLoaderVersionList.cpp b/logic/liteloader/LiteLoaderVersionList.cpp index 48f098d0..89ea5df5 100644 --- a/logic/liteloader/LiteLoaderVersionList.cpp +++ b/logic/liteloader/LiteLoaderVersionList.cpp @@ -220,7 +220,7 @@ void LLListLoadTask::listDownloaded() } catch (MMCError &e) { - QLOG_ERROR() << "Couldn't read JSON object:"; + qCritical() << "Couldn't read JSON object:"; continue; } } diff --git a/logic/minecraft/MinecraftProfile.cpp b/logic/minecraft/MinecraftProfile.cpp index 3fbfd105..9b97b95f 100644 --- a/logic/minecraft/MinecraftProfile.cpp +++ b/logic/minecraft/MinecraftProfile.cpp @@ -214,7 +214,7 @@ QList<std::shared_ptr<OneSixLibrary> > MinecraftProfile::getActiveNormalLibs() { 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; } } diff --git a/logic/minecraft/MinecraftVersionList.cpp b/logic/minecraft/MinecraftVersionList.cpp index 26b51731..2f549752 100644 --- a/logic/minecraft/MinecraftVersionList.cpp +++ b/logic/minecraft/MinecraftVersionList.cpp @@ -129,7 +129,7 @@ void MinecraftVersionList::loadCachedList() if (!localIndex.open(QIODevice::ReadOnly)) { // 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; } auto data = localIndex.readAll(); @@ -146,7 +146,7 @@ void MinecraftVersionList::loadCachedList() catch (MMCError &e) { // 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(); return; } @@ -155,7 +155,7 @@ void MinecraftVersionList::loadCachedList() void MinecraftVersionList::loadBuiltinList() { - QLOG_INFO() << "Loading builtin version list."; + qDebug() << "Loading builtin version list."; // grab the version list data from internal resources. const QJsonDocument doc = MMCJson::parseFile(":/versions/minecraft.json", @@ -170,13 +170,13 @@ void MinecraftVersionList::loadBuiltinList() QString versionTypeStr = versionObj.value("type").toString(""); if (versionID.isEmpty() || versionTypeStr.isEmpty()) { - QLOG_ERROR() << "Parsed version is missing ID or type"; + qCritical() << "Parsed version is missing ID or type"; continue; } if (g_VersionFilterData.legacyBlacklist.contains(versionID)) { - QLOG_WARN() << "Blacklisted legacy version ignored: " << versionID; + qWarning() << "Blacklisted legacy version ignored: " << versionID; continue; } @@ -188,7 +188,7 @@ void MinecraftVersionList::loadBuiltinList() if (!parse_timestamp(versionObj.value("releaseTime").toString(""), mcVersion->m_releaseTimeString, mcVersion->m_releaseTime)) { - QLOG_ERROR() << "Error while parsing version" << versionID + qCritical() << "Error while parsing version" << versionID << ": invalid version timestamp"; continue; } @@ -217,7 +217,7 @@ void MinecraftVersionList::loadBuiltinList() 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()) { @@ -234,7 +234,7 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s } catch (MMCError &err) { - QLOG_ERROR() + qCritical() << 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. if (!version.isObject()) { - QLOG_ERROR() << "Error while parsing version list : invalid JSON structure"; + qCritical() << "Error while parsing version list : invalid JSON structure"; continue; } @@ -260,13 +260,13 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s QString versionID = versionObj.value("id").toString(""); if (versionID.isEmpty()) { - QLOG_ERROR() << "Error while parsing version : version ID is missing"; + qCritical() << "Error while parsing version : version ID is missing"; continue; } if (g_VersionFilterData.legacyBlacklist.contains(versionID)) { - QLOG_WARN() << "Blacklisted legacy version ignored: " << versionID; + qWarning() << "Blacklisted legacy version ignored: " << versionID; continue; } @@ -277,14 +277,14 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s if (!parse_timestamp(versionObj.value("releaseTime").toString(""), mcVersion->m_releaseTimeString, mcVersion->m_releaseTime)) { - QLOG_ERROR() << "Error while parsing version" << versionID + qCritical() << "Error while parsing version" << versionID << ": invalid release timestamp"; continue; } if (!parse_timestamp(versionObj.value("time").toString(""), mcVersion->m_updateTimeString, mcVersion->m_updateTime)) { - QLOG_ERROR() << "Error while parsing version" << versionID + qCritical() << "Error while parsing version" << versionID << ": invalid update timestamp"; continue; } @@ -302,7 +302,7 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s QString versionTypeStr = versionObj.value("type").toString(""); if (versionTypeStr.isEmpty()) { - QLOG_ERROR() << "Ignoring" << versionID + qCritical() << "Ignoring" << versionID << "because it doesn't have the version type set."; continue; } @@ -321,12 +321,12 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s } else { - QLOG_ERROR() << "Ignoring" << versionID + qCritical() << "Ignoring" << versionID << "because it has an invalid version type."; continue; } mcVersion->m_type = versionTypeStr; - QLOG_INFO() << "Loaded version" << versionID << "from" + qDebug() << "Loaded version" << versionID << "from" << ((source == Remote) ? "remote" : "local") << "version list."; tempList.append(mcVersion); } @@ -494,7 +494,7 @@ void MCVListVersionUpdateTask::json_downloaded() // now dump the file to disk auto doc = file->toJson(false); auto newdata = doc.toBinaryData(); - QLOG_INFO() << newdata; + qDebug() << newdata; QString targetPath = "versions/" + versionToUpdate + "/" + versionToUpdate + ".dat"; ensureFilePathExists(targetPath); QSaveFile vfile1(targetPath); diff --git a/logic/minecraft/OneSixProfileStrategy.cpp b/logic/minecraft/OneSixProfileStrategy.cpp index 5c0658d0..9fcd0336 100644 --- a/logic/minecraft/OneSixProfileStrategy.cpp +++ b/logic/minecraft/OneSixProfileStrategy.cpp @@ -116,10 +116,10 @@ void OneSixProfileStrategy::loadUserPatches() QFileInfo finfo(filename); if(!finfo.exists()) { - QLOG_INFO() << "Patch file " << filename << " was deleted by external means..."; + qDebug() << "Patch file " << filename << " was deleted by external means..."; continue; } - QLOG_INFO() << "Reading" << filename << "by user order"; + qDebug() << "Reading" << filename << "by user order"; auto file = ProfileUtils::parseJsonFile(finfo, false); // sanity check. prevent tampering with files. if (file->fileId != id) @@ -134,7 +134,7 @@ void OneSixProfileStrategy::loadUserPatches() for (auto info : patches.entryInfoList(QStringList() << "*.json", QDir::Files)) { // parse the file - QLOG_INFO() << "Reading" << info.fileName(); + qDebug() << "Reading" << info.fileName(); auto file = ProfileUtils::parseJsonFile(info, true); // ignore builtins if (file->fileId == "net.minecraft") @@ -253,7 +253,7 @@ bool OneSixProfileStrategy::installJarMods(QStringList filepaths) QFile file(patchFileName); if (!file.open(QFile::WriteOnly)) { - QLOG_ERROR() << "Error opening" << file.fileName() + qCritical() << "Error opening" << file.fileName() << "for reading:" << file.errorString(); return false; } diff --git a/logic/minecraft/ProfileUtils.cpp b/logic/minecraft/ProfileUtils.cpp index db05b0a6..21fcb2ef 100644 --- a/logic/minecraft/ProfileUtils.cpp +++ b/logic/minecraft/ProfileUtils.cpp @@ -1,7 +1,7 @@ #include "ProfileUtils.h" #include "logic/minecraft/VersionFilterData.h" #include "logic/MMCJson.h" -#include "logger/QsLog.h" +#include <QDebug> #include <QJsonDocument> #include <QJsonArray> @@ -26,7 +26,7 @@ bool writeOverrideOrders(QString path, const PatchOrder &order) QSaveFile orderFile(path); if (!orderFile.open(QFile::WriteOnly)) { - QLOG_ERROR() << "Couldn't open" << orderFile.fileName() + qCritical() << "Couldn't open" << orderFile.fileName() << "for writing:" << orderFile.errorString(); return false; } @@ -50,14 +50,14 @@ bool readOverrideOrders(QString path, PatchOrder &order) QFile orderFile(path); if (!orderFile.exists()) { - QLOG_WARN() << "Order file doesn't exist. Ignoring."; + qWarning() << "Order file doesn't exist. Ignoring."; return false; } if (!orderFile.open(QFile::ReadOnly)) { - QLOG_ERROR() << "Couldn't open" << orderFile.fileName() + qCritical() << "Couldn't open" << orderFile.fileName() << " for reading:" << orderFile.errorString(); - QLOG_WARN() << "Ignoring overriden order"; + qWarning() << "Ignoring overriden order"; return false; } @@ -66,8 +66,8 @@ bool readOverrideOrders(QString path, PatchOrder &order) QJsonDocument doc = QJsonDocument::fromJson(orderFile.readAll(), &error); if (error.error != QJsonParseError::NoError) { - QLOG_ERROR() << "Couldn't parse" << orderFile.fileName() << ":" << error.errorString(); - QLOG_WARN() << "Ignoring overriden order"; + qCritical() << "Couldn't parse" << orderFile.fileName() << ":" << error.errorString(); + qWarning() << "Ignoring overriden order"; return false; } @@ -90,8 +90,8 @@ bool readOverrideOrders(QString path, PatchOrder &order) } catch (JSONValidationError &err) { - QLOG_ERROR() << "Couldn't parse" << orderFile.fileName() << ": bad file format"; - QLOG_WARN() << "Ignoring overriden order"; + qCritical() << "Couldn't parse" << orderFile.fileName() << ": bad file format"; + qWarning() << "Ignoring overriden order"; order.clear(); return false; } diff --git a/logic/minecraft/RawLibrary.cpp b/logic/minecraft/RawLibrary.cpp index c3df6e0c..87dbf3ec 100644 --- a/logic/minecraft/RawLibrary.cpp +++ b/logic/minecraft/RawLibrary.cpp @@ -21,7 +21,7 @@ RawLibraryPtr RawLibrary::fromJson(const QJsonObject &libObj, const QString &fil if (!val.isString()) { - QLOG_WARN() << key << "is not a string in" << filename << "(skipping)"; + qWarning() << key << "is not a string in" << filename << "(skipping)"; return false; } @@ -49,7 +49,7 @@ RawLibraryPtr RawLibrary::fromJson(const QJsonObject &libObj, const QString &fil { 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()); if (opSys != Os_Other) @@ -215,7 +215,7 @@ bool RawLibrary::filesExist(const QDir &base) const for(auto file: libFiles) { QFileInfo info(base, file); - QLOG_WARN() << info.absoluteFilePath() << "doesn't exist"; + qWarning() << info.absoluteFilePath() << "doesn't exist"; if (!info.exists()) return false; } diff --git a/logic/minecraft/VersionBuilder.cpp b/logic/minecraft/VersionBuilder.cpp index 2a7096e8..f3a0d490 100644 --- a/logic/minecraft/VersionBuilder.cpp +++ b/logic/minecraft/VersionBuilder.cpp @@ -38,7 +38,7 @@ #include "logic/OneSixInstance.h" #include "logic/MMCJson.h" -#include "logger/QsLog.h" +#include <QDebug> VersionBuilder::VersionBuilder() { diff --git a/logic/minecraft/VersionFile.cpp b/logic/minecraft/VersionFile.cpp index f5856936..275be12e 100644 --- a/logic/minecraft/VersionFile.cpp +++ b/logic/minecraft/VersionFile.cpp @@ -2,7 +2,7 @@ #include <QJsonDocument> #include <modutils.h> -#include "logger/QsLog.h" +#include <QDebug> #include "logic/minecraft/VersionFile.h" #include "logic/minecraft/OneSixLibrary.h" @@ -57,7 +57,7 @@ VersionFilePtr VersionFile::fromJson(const QJsonDocument &doc, const QString &fi else { // 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: { - // QLOG_INFO() << "Applying lib " << lib->name; + // qDebug() << "Applying lib " << lib->name; int index = findLibraryByName(version->libraries, addedLibrary->rawName()); if (index >= 0) { @@ -396,7 +396,7 @@ void VersionFile::applyTo(MinecraftProfile *version) } else { - QLOG_WARN() << "Couldn't find" << addedLibrary->rawName() << "(skipping)"; + qWarning() << "Couldn't find" << addedLibrary->rawName() << "(skipping)"; } break; } @@ -476,7 +476,7 @@ void VersionFile::applyTo(MinecraftProfile *version) { toReplace = addedLibrary->insertData; } - // QLOG_INFO() << "Replacing lib " << toReplace << " with " << lib->name; + // qDebug() << "Replacing lib " << toReplace << " with " << lib->name; int index = findLibraryByName(version->libraries, toReplace); if (index >= 0) { @@ -484,7 +484,7 @@ void VersionFile::applyTo(MinecraftProfile *version) } else { - QLOG_WARN() << "Couldn't find" << toReplace << "(skipping)"; + qWarning() << "Couldn't find" << toReplace << "(skipping)"; } break; } @@ -495,12 +495,12 @@ void VersionFile::applyTo(MinecraftProfile *version) int index = findLibraryByName(version->libraries, lib); if (index >= 0) { - // QLOG_INFO() << "Removing lib " << lib; + // qDebug() << "Removing lib " << lib; version->libraries.removeAt(index); } else { - QLOG_WARN() << "Couldn't find" << lib << "(skipping)"; + qWarning() << "Couldn't find" << lib << "(skipping)"; } } } diff --git a/logic/net/ByteArrayDownload.cpp b/logic/net/ByteArrayDownload.cpp index e56ac9b6..9f71f911 100644 --- a/logic/net/ByteArrayDownload.cpp +++ b/logic/net/ByteArrayDownload.cpp @@ -15,7 +15,7 @@ #include "ByteArrayDownload.h" #include "logic/Env.h" -#include "logger/QsLog.h" +#include <QDebug> ByteArrayDownload::ByteArrayDownload(QUrl url) : NetAction() { @@ -25,7 +25,7 @@ ByteArrayDownload::ByteArrayDownload(QUrl url) : NetAction() void ByteArrayDownload::start() { - QLOG_INFO() << "Downloading " << m_url.toString(); + qDebug() << "Downloading " << m_url.toString(); QNetworkRequest request(m_url); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); auto worker = ENV.qnam(); @@ -50,7 +50,7 @@ void ByteArrayDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal void ByteArrayDownload::downloadError(QNetworkReply::NetworkError error) { // error happened during download. - QLOG_ERROR() << "Error getting URL:" << m_url.toString().toLocal8Bit() + qCritical() << "Error getting URL:" << m_url.toString().toLocal8Bit() << "Network error: " << error; m_status = Job_Failed; m_errorString = m_reply->errorString(); @@ -74,7 +74,7 @@ void ByteArrayDownload::downloadFinished() if (!redirectURL.isEmpty()) { m_url = QUrl(redirect.toString()); - QLOG_INFO() << "Following redirect to " << m_url.toString(); + qDebug() << "Following redirect to " << m_url.toString(); start(); return; } diff --git a/logic/net/CacheDownload.cpp b/logic/net/CacheDownload.cpp index 1bf59c60..6ddfc55f 100644 --- a/logic/net/CacheDownload.cpp +++ b/logic/net/CacheDownload.cpp @@ -19,7 +19,7 @@ #include <QCryptographicHash> #include <QFileInfo> #include <QDateTime> -#include "logger/QsLog.h" +#include <QDebug> #include "logic/Env.h" CacheDownload::CacheDownload(QUrl url, MetaEntryPtr entry) @@ -46,19 +46,19 @@ void CacheDownload::start() // if there already is a file and md5 checking is in effect and it can be opened if (!ensureFilePathExists(m_target_path)) { - QLOG_ERROR() << "Could not create folder for " + m_target_path; + qCritical() << "Could not create folder for " + m_target_path; m_status = Job_Failed; emit failed(m_index_within_job); return; } if (!m_output_file->open(QIODevice::WriteOnly)) { - QLOG_ERROR() << "Could not open " + m_target_path + " for writing"; + qCritical() << "Could not open " + m_target_path + " for writing"; m_status = Job_Failed; emit failed(m_index_within_job); return; } - QLOG_INFO() << "Downloading " << m_url.toString(); + qDebug() << "Downloading " << m_url.toString(); QNetworkRequest request(m_url); // check file consistency first. @@ -96,7 +96,7 @@ void CacheDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) void CacheDownload::downloadError(QNetworkReply::NetworkError error) { // error happened during download. - QLOG_ERROR() << "Failed " << m_url.toString() << " with reason " << error; + qCritical() << "Failed " << m_url.toString() << " with reason " << error; m_status = Job_Failed; } void CacheDownload::downloadFinished() @@ -117,7 +117,7 @@ void CacheDownload::downloadFinished() if (!redirectURL.isEmpty()) { m_url = QUrl(redirect.toString()); - QLOG_INFO() << "Following redirect to " << m_url.toString(); + qDebug() << "Following redirect to " << m_url.toString(); start(); return; } @@ -142,7 +142,7 @@ void CacheDownload::downloadFinished() } else { - QLOG_ERROR() << "Failed to commit changes to " << m_target_path; + qCritical() << "Failed to commit changes to " << m_target_path; m_output_file->cancelWriting(); m_reply.reset(); m_status = Job_Failed; @@ -181,7 +181,7 @@ void CacheDownload::downloadReadyRead() md5sum.addData(ba); if (m_output_file->write(ba) != ba.size()) { - QLOG_ERROR() << "Failed writing into " + m_target_path; + qCritical() << "Failed writing into " + m_target_path; m_status = Job_Failed; m_reply->abort(); emit failed(m_index_within_job); diff --git a/logic/net/HttpMetaCache.cpp b/logic/net/HttpMetaCache.cpp index eb931b8a..7e52f16c 100644 --- a/logic/net/HttpMetaCache.cpp +++ b/logic/net/HttpMetaCache.cpp @@ -24,7 +24,7 @@ #include <QDateTime> #include <QCryptographicHash> -#include "logger/QsLog.h" +#include <QDebug> #include <QJsonDocument> #include <QJsonArray> @@ -122,13 +122,13 @@ bool HttpMetaCache::updateEntry(MetaEntryPtr stale_entry) { if (!m_entries.contains(stale_entry->base)) { - QLOG_ERROR() << "Cannot add entry with unknown base: " + qCritical() << "Cannot add entry with unknown base: " << stale_entry->base.toLocal8Bit(); return false; } if (stale_entry->stale) { - QLOG_ERROR() << "Cannot add stale entry: " << stale_entry->getFullPath().toLocal8Bit(); + qCritical() << "Cannot add stale entry: " << stale_entry->getFullPath().toLocal8Bit(); return false; } m_entries[stale_entry->base].entry_list[stale_entry->path] = stale_entry; diff --git a/logic/net/MD5EtagDownload.cpp b/logic/net/MD5EtagDownload.cpp index 79038f36..6e1d0cfc 100644 --- a/logic/net/MD5EtagDownload.cpp +++ b/logic/net/MD5EtagDownload.cpp @@ -17,7 +17,7 @@ #include "MD5EtagDownload.h" #include <pathutils.h> #include <QCryptographicHash> -#include "logger/QsLog.h" +#include <QDebug> MD5EtagDownload::MD5EtagDownload(QUrl url, QString target_path) : NetAction() { @@ -45,7 +45,7 @@ void MD5EtagDownload::start() // skip if they match if(m_local_md5 == m_expected_md5) { - QLOG_INFO() << "Skipping " << m_url.toString() << ": md5 match."; + qDebug() << "Skipping " << m_url.toString() << ": md5 match."; emit succeeded(m_index_within_job); return; } @@ -63,14 +63,14 @@ void MD5EtagDownload::start() QNetworkRequest request(m_url); - QLOG_INFO() << "Downloading " << m_url.toString() << " local MD5: " << m_local_md5; + qDebug() << "Downloading " << m_url.toString() << " local MD5: " << m_local_md5; if(!m_local_md5.isEmpty()) { request.setRawHeader(QString("If-None-Match").toLatin1(), m_local_md5.toLatin1()); } if(!m_expected_md5.isEmpty()) - QLOG_INFO() << "Expecting " << m_expected_md5; + qDebug() << "Expecting " << m_expected_md5; request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); @@ -104,7 +104,7 @@ void MD5EtagDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) void MD5EtagDownload::downloadError(QNetworkReply::NetworkError error) { - QLOG_ERROR() << "Error" << error << ":" << m_reply->errorString() << "while downloading" + qCritical() << "Error" << error << ":" << m_reply->errorString() << "while downloading" << m_reply->url(); m_status = Job_Failed; } @@ -120,7 +120,7 @@ void MD5EtagDownload::downloadFinished() // FIXME: compare with the real written data md5sum // this is just an ETag - QLOG_INFO() << "Finished " << m_url.toString() << " got " << m_reply->rawHeader("ETag").constData(); + qDebug() << "Finished " << m_url.toString() << " got " << m_reply->rawHeader("ETag").constData(); m_reply.reset(); emit succeeded(m_index_within_job); diff --git a/logic/net/NetJob.cpp b/logic/net/NetJob.cpp index c5f93ae1..e10afbc8 100644 --- a/logic/net/NetJob.cpp +++ b/logic/net/NetJob.cpp @@ -19,7 +19,7 @@ #include "ByteArrayDownload.h" #include "CacheDownload.h" -#include "logger/QsLog.h" +#include <QDebug> void NetJob::partSucceeded(int index) { @@ -66,7 +66,7 @@ void NetJob::partProgress(int index, qint64 bytesReceived, qint64 bytesTotal) void NetJob::start() { - QLOG_INFO() << m_job_name.toLocal8Bit() << " started."; + qDebug() << m_job_name.toLocal8Bit() << " started."; m_running = true; for (int i = 0; i < downloads.size(); i++) { @@ -85,12 +85,12 @@ void NetJob::startMoreParts() { if(!m_failed.size()) { - QLOG_INFO() << m_job_name.toLocal8Bit() << "succeeded."; + qDebug() << m_job_name.toLocal8Bit() << "succeeded."; emit succeeded(); } else { - QLOG_ERROR() << m_job_name.toLocal8Bit() << "failed."; + qCritical() << m_job_name.toLocal8Bit() << "failed."; emit failed(); } } diff --git a/logic/net/PasteUpload.cpp b/logic/net/PasteUpload.cpp index f68595c9..6bed0887 100644 --- a/logic/net/PasteUpload.cpp +++ b/logic/net/PasteUpload.cpp @@ -1,6 +1,6 @@ #include "PasteUpload.h" #include "logic/Env.h" -#include "logger/QsLog.h" +#include <QDebug> #include <QJsonObject> #include <QJsonDocument> @@ -40,7 +40,7 @@ void PasteUpload::executeTask() void PasteUpload::downloadError(QNetworkReply::NetworkError error) { // error happened during download. - QLOG_ERROR() << "Network error: " << error; + qCritical() << "Network error: " << error; emitFailed(m_reply->errorString()); } @@ -80,7 +80,7 @@ bool PasteUpload::parseResult(QJsonDocument doc) auto status = object.value("status").toString("error"); if (status == "error") { - QLOG_ERROR() << "paste.ee reported error:" << QString(object.value("error").toString()); + qCritical() << "paste.ee reported error:" << QString(object.value("error").toString()); return false; } m_pasteLink = object.value("paste").toObject().value("link").toString(); diff --git a/logic/news/NewsChecker.cpp b/logic/news/NewsChecker.cpp index 1b4ebb92..39796e36 100644 --- a/logic/news/NewsChecker.cpp +++ b/logic/news/NewsChecker.cpp @@ -18,7 +18,7 @@ #include <QByteArray> #include <QDomDocument> -#include <logger/QsLog.h> +#include <QDebug> 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. if (isLoadingNews()) { - QLOG_INFO() << "Ignored request to reload news. Currently reloading already."; + qDebug() << "Ignored request to reload news. Currently reloading already."; return; } - QLOG_INFO() << "Reloading news."; + qDebug() << "Reloading news."; NetJob* job = new NetJob("News RSS Feed"); job->addNetAction(ByteArrayDownload::make(m_feedUrl)); @@ -47,7 +47,7 @@ void NewsChecker::reloadNews() void NewsChecker::rssDownloadFinished() { // Parse the XML file and process the RSS feed entries. - QLOG_DEBUG() << "Finished loading RSS feed."; + qDebug() << "Finished loading RSS feed."; QByteArray data; { @@ -83,12 +83,12 @@ void NewsChecker::rssDownloadFinished() QString errorMsg = "An unknown error occurred."; if (NewsEntry::fromXmlElement(element, entry.get(), &errorMsg)) { - QLOG_DEBUG() << "Loaded news entry" << entry->title; + qDebug() << "Loaded news entry" << entry->title; m_newsEntries.append(entry); } 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() { m_lastLoadError = ""; - QLOG_DEBUG() << "News loading succeeded."; + qDebug() << "News loading succeeded."; m_newsNetJob.reset(); emit newsLoaded(); } @@ -128,7 +128,7 @@ void NewsChecker::succeed() void NewsChecker::fail(const QString& errorMsg) { m_lastLoadError = errorMsg; - QLOG_DEBUG() << "Failed to load news:" << errorMsg; + qDebug() << "Failed to load news:" << errorMsg; m_newsNetJob.reset(); emit newsLoadingFailed(errorMsg); } diff --git a/logic/screenshots/ImgurAlbumCreation.cpp b/logic/screenshots/ImgurAlbumCreation.cpp index 86edd5a5..45db75cf 100644 --- a/logic/screenshots/ImgurAlbumCreation.cpp +++ b/logic/screenshots/ImgurAlbumCreation.cpp @@ -8,7 +8,7 @@ #include "logic/net/URLConstants.h" #include "logic/Env.h" -#include "logger/QsLog.h" +#include <QDebug> ImgurAlbumCreation::ImgurAlbumCreation(QList<ScreenshotPtr> screenshots) : NetAction(), m_screenshots(screenshots) { @@ -44,7 +44,7 @@ void ImgurAlbumCreation::start() } void ImgurAlbumCreation::downloadError(QNetworkReply::NetworkError error) { - QLOG_DEBUG() << m_reply->errorString(); + qDebug() << m_reply->errorString(); m_status = Job_Failed; } void ImgurAlbumCreation::downloadFinished() @@ -57,14 +57,14 @@ void ImgurAlbumCreation::downloadFinished() QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError); if (jsonError.error != QJsonParseError::NoError) { - QLOG_DEBUG() << jsonError.errorString(); + qDebug() << jsonError.errorString(); emit failed(m_index_within_job); return; } auto object = doc.object(); if (!object.value("success").toBool()) { - QLOG_DEBUG() << doc.toJson(); + qDebug() << doc.toJson(); emit failed(m_index_within_job); return; } @@ -76,7 +76,7 @@ void ImgurAlbumCreation::downloadFinished() } else { - QLOG_DEBUG() << m_reply->readAll(); + qDebug() << m_reply->readAll(); m_reply.reset(); emit failed(m_index_within_job); return; diff --git a/logic/screenshots/ImgurUpload.cpp b/logic/screenshots/ImgurUpload.cpp index 91643e68..1d490436 100644 --- a/logic/screenshots/ImgurUpload.cpp +++ b/logic/screenshots/ImgurUpload.cpp @@ -10,7 +10,7 @@ #include "logic/net/URLConstants.h" #include "logic/Env.h" -#include "logger/QsLog.h" +#include <QDebug> ImgurUpload::ImgurUpload(ScreenshotPtr shot) : NetAction(), m_shot(shot) { @@ -59,7 +59,7 @@ void ImgurUpload::start() } void ImgurUpload::downloadError(QNetworkReply::NetworkError error) { - QLOG_DEBUG() << m_reply->errorString(); + qDebug() << m_reply->errorString(); m_status = Job_Failed; } void ImgurUpload::downloadFinished() @@ -72,14 +72,14 @@ void ImgurUpload::downloadFinished() QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError); if (jsonError.error != QJsonParseError::NoError) { - QLOG_DEBUG() << jsonError.errorString(); + qDebug() << jsonError.errorString(); emit failed(m_index_within_job); return; } auto object = doc.object(); if (!object.value("success").toBool()) { - QLOG_DEBUG() << doc.toJson(); + qDebug() << doc.toJson(); emit failed(m_index_within_job); return; } @@ -91,7 +91,7 @@ void ImgurUpload::downloadFinished() } else { - QLOG_DEBUG() << m_reply->readAll(); + qDebug() << m_reply->readAll(); m_reply.reset(); emit failed(m_index_within_job); return; diff --git a/logic/settings/SettingsObject.cpp b/logic/settings/SettingsObject.cpp index b28033c5..280c07fa 100644 --- a/logic/settings/SettingsObject.cpp +++ b/logic/settings/SettingsObject.cpp @@ -16,7 +16,7 @@ #include "logic/settings/SettingsObject.h" #include "logic/settings/Setting.h" #include "logic/settings/OverrideSetting.h" -#include "logger/QsLog.h" +#include <QDebug> #include <QVariant> @@ -33,7 +33,7 @@ std::shared_ptr<Setting> SettingsObject::registerOverride(std::shared_ptr<Settin { 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()); return nullptr; // Fail } @@ -50,7 +50,7 @@ std::shared_ptr<Setting> SettingsObject::registerSetting(QStringList synonyms, Q return nullptr; 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()); return nullptr; // Fail } @@ -81,7 +81,7 @@ bool SettingsObject::set(const QString &id, QVariant value) auto setting = getSetting(id); 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; } else diff --git a/logic/status/StatusChecker.cpp b/logic/status/StatusChecker.cpp index 287d2609..0e60db40 100644 --- a/logic/status/StatusChecker.cpp +++ b/logic/status/StatusChecker.cpp @@ -20,7 +20,7 @@ #include <QByteArray> #include <QDomDocument> -#include <logger/QsLog.h> +#include <QDebug> StatusChecker::StatusChecker() { @@ -37,11 +37,11 @@ void StatusChecker::reloadStatus() { if (isLoadingStatus()) { - // QLOG_INFO() << "Ignored request to reload status. Currently reloading already."; + // qDebug() << "Ignored request to reload status. Currently reloading already."; return; } - // QLOG_INFO() << "Reloading status."; + // qDebug() << "Reloading status."; NetJob* job = new NetJob("Status JSON"); job->addNetAction(ByteArrayDownload::make(URLConstants::MOJANG_STATUS_URL)); @@ -54,7 +54,7 @@ void StatusChecker::reloadStatus() void StatusChecker::statusDownloadFinished() { - QLOG_DEBUG() << "Finished loading status JSON."; + qDebug() << "Finished loading status JSON."; m_statusEntries.clear(); QByteArray data; { @@ -92,7 +92,7 @@ void StatusChecker::statusDownloadFinished() if(value.type() == QVariant::Type::String) { m_statusEntries.insert(key, value.toString()); - //QLOG_DEBUG() << "Status JSON object: " << key << m_statusEntries[key]; + //qDebug() << "Status JSON object: " << key << m_statusEntries[key]; } else { @@ -134,7 +134,7 @@ void StatusChecker::succeed() m_prevEntries = m_statusEntries; } m_lastLoadError = ""; - QLOG_DEBUG() << "Status loading succeeded."; + qDebug() << "Status loading succeeded."; m_statusNetJob.reset(); emit statusLoading(false); } @@ -147,7 +147,7 @@ void StatusChecker::fail(const QString& errorMsg) m_prevEntries = m_statusEntries; } m_lastLoadError = errorMsg; - QLOG_DEBUG() << "Failed to load status:" << errorMsg; + qDebug() << "Failed to load status:" << errorMsg; m_statusNetJob.reset(); emit statusLoading(false); } diff --git a/logic/tasks/Task.cpp b/logic/tasks/Task.cpp index 2970459d..56f8bf01 100644 --- a/logic/tasks/Task.cpp +++ b/logic/tasks/Task.cpp @@ -14,7 +14,7 @@ */ #include "Task.h" -#include "logger/QsLog.h" +#include <QDebug> Task::Task(QObject *parent) : ProgressProvider(parent) { @@ -42,7 +42,7 @@ void Task::emitFailed(QString reason) m_running = false; m_succeeded = false; m_failReason = reason; - QLOG_ERROR() << "Task failed: " << reason; + qCritical() << "Task failed: " << reason; emit failed(reason); } @@ -51,7 +51,7 @@ void Task::emitSucceeded() if (!m_running) { return; } // Don't succeed twice. m_running = false; m_succeeded = true; - QLOG_INFO() << "Task succeeded"; + qDebug() << "Task succeeded"; emit succeeded(); } diff --git a/logic/trans/TranslationDownloader.cpp b/logic/trans/TranslationDownloader.cpp index 77f1b9f7..e977b65c 100644 --- a/logic/trans/TranslationDownloader.cpp +++ b/logic/trans/TranslationDownloader.cpp @@ -4,14 +4,14 @@ #include "logic/net/CacheDownload.h" #include "logic/net/URLConstants.h" #include "logic/Env.h" -#include "logger/QsLog.h" +#include <QDebug> TranslationDownloader::TranslationDownloader() { } void TranslationDownloader::downloadTranslations() { - QLOG_DEBUG() << "Downloading Translations Index..."; + qDebug() << "Downloading Translations Index..."; m_index_job.reset(new NetJob("Translations Index")); m_index_task = ByteArrayDownload::make(QUrl("http://files.multimc.org/translations/index")); m_index_job->addNetAction(m_index_task); @@ -21,7 +21,7 @@ void TranslationDownloader::downloadTranslations() } void TranslationDownloader::indexRecieved() { - QLOG_DEBUG() << "Got translations index!"; + qDebug() << "Got translations index!"; m_dl_job.reset(new NetJob("Translations")); QList<QByteArray> lines = m_index_task->m_data.split('\n'); for (const auto line : lines) @@ -42,13 +42,13 @@ void TranslationDownloader::indexRecieved() } void TranslationDownloader::dlFailed() { - QLOG_ERROR() << "Translations Download Failed!"; + qCritical() << "Translations Download Failed!"; } void TranslationDownloader::dlGood() { - QLOG_DEBUG() << "Got translations!"; + qDebug() << "Got translations!"; } void TranslationDownloader::indexFailed() { - QLOG_ERROR() << "Translations Index Download Failed!"; + qCritical() << "Translations Index Download Failed!"; } diff --git a/logic/updater/DownloadUpdateTask.cpp b/logic/updater/DownloadUpdateTask.cpp index af0cf0a8..228d26d2 100644 --- a/logic/updater/DownloadUpdateTask.cpp +++ b/logic/updater/DownloadUpdateTask.cpp @@ -56,7 +56,7 @@ void DownloadUpdateTask::processChannels() if (!checker->hasChannels()) { // 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(); return; } @@ -70,7 +70,7 @@ void DownloadUpdateTask::processChannels() { if (channel.id == channelId) { - QLOG_INFO() << "Found matching channel."; + qDebug() << "Found matching channel."; m_cRepoUrl = channel.url; break; } @@ -89,7 +89,7 @@ void DownloadUpdateTask::findCurrentVersionInfo() if (!checker->hasChannels()) { // 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, &DownloadUpdateTask::processChannels); @@ -110,7 +110,7 @@ void DownloadUpdateTask::loadVersionInfo() // Find the index URL. 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. netJob->addNetAction(ByteArrayDownload::make(newIndexUrl)); @@ -120,7 +120,7 @@ void DownloadUpdateTask::loadVersionInfo() { QUrl cIndexUrl = QUrl(m_cRepoUrl).resolved(QString::number(m_cVersionId) + ".json"); 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. @@ -152,14 +152,14 @@ void DownloadUpdateTask::vinfoDownloadFailed() } // 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.")); } void DownloadUpdateTask::parseDownloadedVersionInfo() { 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; if (!parseVersionInfo( 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) { 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; parseVersionInfo( 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") .arg(jsonError.errorString()) .arg(jsonError.offset); - QLOG_ERROR() << error; + qCritical() << error; return false; } QJsonObject json = jsonDoc.object(); - QLOG_DEBUG() << data; - QLOG_DEBUG() << "Loading version info from JSON."; + qDebug() << data; + qDebug() << "Loading version info from JSON."; QJsonArray filesArray = json.value("Files").toArray(); for (QJsonValue fileValue : filesArray) { @@ -223,7 +223,7 @@ bool DownloadUpdateTask::parseVersionInfo(const QByteArray &data, VersionFileLis #endif VersionFileEntry file{file_path, fileObj.value("Perms").toVariant().toInt(), 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(); for (QJsonValue val : sourceArray) @@ -244,11 +244,11 @@ bool DownloadUpdateTask::parseVersionInfo(const QByteArray &data, VersionFileLis } 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); } @@ -276,7 +276,7 @@ void DownloadUpdateTask::processFileLists() // Now start the download. 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); netJob->start(); @@ -298,7 +298,7 @@ DownloadUpdateTask::processFileLists(NetJob *job, QFileInfo toDelete(PathCombine(m_rootPath, entry.path)); if (!toDelete.exists()) { - QLOG_ERROR() << "Expected file " << toDelete.absoluteFilePath() + qCritical() << "Expected file " << toDelete.absoluteFilePath() << " doesn't exist!"; } bool keep = false; @@ -308,7 +308,7 @@ DownloadUpdateTask::processFileLists(NetJob *job, { 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."; keep = true; break; @@ -343,17 +343,17 @@ DownloadUpdateTask::processFileLists(NetJob *job, bool pass = true; if (!entryInfo.isReadable()) { - QLOG_ERROR() << "File " << realEntryPath << " is not readable."; + qCritical() << "File " << realEntryPath << " is not readable."; pass = false; } if (!entryInfo.isWritable()) { - QLOG_ERROR() << "File " << realEntryPath << " is not writable."; + qCritical() << "File " << realEntryPath << " is not writable."; pass = false; } if (!entryFile.open(QFile::ReadOnly)) { - QLOG_ERROR() << "File " << realEntryPath << " cannot be opened for reading."; + qCritical() << "File " << realEntryPath << " cannot be opened for reading."; pass = false; } if (!pass) @@ -372,9 +372,9 @@ DownloadUpdateTask::processFileLists(NetJob *job, fileMD5 = hash.result().toHex(); if ((fileMD5 != entry.md5)) { - QLOG_DEBUG() << "MD5Sum does not match!"; - QLOG_DEBUG() << "Expected:'" << entry.md5 << "'"; - QLOG_DEBUG() << "Got: '" << fileMD5 << "'"; + qDebug() << "MD5Sum does not match!"; + qDebug() << "Expected:'" << entry.md5 << "'"; + qDebug() << "Got: '" << fileMD5 << "'"; needs_upgrade = true; } } @@ -382,12 +382,12 @@ DownloadUpdateTask::processFileLists(NetJob *job, // skip file. it doesn't need an upgrade. if (!needs_upgrade) { - QLOG_DEBUG() << "File" << realEntryPath << " does not need updating."; + qDebug() << "File" << realEntryPath << " does not need updating."; continue; } // 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 bool isUpdater = entry.path.endsWith("updater") || entry.path.endsWith("updater.exe"); @@ -399,7 +399,7 @@ DownloadUpdateTask::processFileLists(NetJob *job, { 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 // path with slashes replaced by underscores. @@ -410,12 +410,12 @@ DownloadUpdateTask::processFileLists(NetJob *job, { if(BuildConfig.UPDATER_FORCE_LOCAL) { - QLOG_DEBUG() << "Skipping updater download and using local version."; + qDebug() << "Skipping updater download and using local version."; } else { 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. cache_entry->stale = true; @@ -475,7 +475,7 @@ bool DownloadUpdateTask::writeInstallScript(UpdateOperationList &opsList, QStrin file.appendChild(path); file.appendChild(mode); installFiles.appendChild(file); - QLOG_DEBUG() << "Will install file " << op.file << " to " << op.dest; + qDebug() << "Will install file " << op.file << " to " << op.dest; } break; @@ -484,12 +484,12 @@ bool DownloadUpdateTask::writeInstallScript(UpdateOperationList &opsList, QStrin // Delete the file. file.appendChild(doc.createTextNode(op.file)); removeFiles.appendChild(file); - QLOG_DEBUG() << "Will remove file" << op.file; + qDebug() << "Will remove file" << op.file; } break; 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."; continue; } @@ -521,7 +521,7 @@ bool DownloadUpdateTask::fixPathForOSX(QString &path) } else { - QLOG_ERROR() << "Update path not within .app: " << path; + qCritical() << "Update path not within .app: " << path; return false; } } @@ -534,7 +534,7 @@ void DownloadUpdateTask::fileDownloadFinished() void DownloadUpdateTask::fileDownloadFailed() { // 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.")); } diff --git a/logic/updater/NotificationChecker.cpp b/logic/updater/NotificationChecker.cpp index 7a3f314b..3f8b17ba 100644 --- a/logic/updater/NotificationChecker.cpp +++ b/logic/updater/NotificationChecker.cpp @@ -7,7 +7,7 @@ #include "logic/Env.h" #include "BuildConfig.h" #include "logic/net/CacheDownload.h" -#include "logger/QsLog.h" +#include <QDebug> NotificationChecker::NotificationChecker(QObject *parent) : QObject(parent), m_notificationsUrl(QUrl(BuildConfig.NOTIFICATION_URL)) @@ -34,7 +34,7 @@ void NotificationChecker::checkForNotifications() { 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 " "URL to CMake at compile time."; return; diff --git a/tests/tst_DownloadUpdateTask.cpp b/tests/tst_DownloadUpdateTask.cpp index 88c4d3d8..524095ed 100644 --- a/tests/tst_DownloadUpdateTask.cpp +++ b/tests/tst_DownloadUpdateTask.cpp @@ -228,14 +228,14 @@ slots: /* void test_masterTest() { - QLOG_INFO() << "#####################"; + qDebug() << "#####################"; MMC->m_version.build = 1; MMC->m_version.channel = "develop"; auto channels = QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/channels.json")); auto root = QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/")); - QLOG_DEBUG() << "channels: " << channels; - QLOG_DEBUG() << "root: " << root; + qDebug() << "channels: " << channels; + qDebug() << "root: " << root; MMC->updateChecker()->setChannelListUrl(channels.toString()); MMC->updateChecker()->setCurrentChannel("develop"); |