summaryrefslogtreecommitdiffstats
path: root/MultiMC.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-10-06 01:13:40 +0200
committerPetr Mrázek <peterix@gmail.com>2013-10-06 01:13:40 +0200
commitf83119ce7ec3d11a903901b8eff762d2b0a9f635 (patch)
tree5c30d7b9fff0f9417e7f2cd79d8ad9ea56d7f056 /MultiMC.cpp
parenteba9b3d759dbf6e402e91ab897059f1d274aef90 (diff)
downloadMultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar
MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar.gz
MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar.lz
MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar.xz
MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.zip
Added file logger
Diffstat (limited to 'MultiMC.cpp')
-rw-r--r--MultiMC.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/MultiMC.cpp b/MultiMC.cpp
index ee9a9bf8..b685ed13 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -20,6 +20,8 @@
#include "cmdutils.h"
#include <inisettingsobject.h>
#include <setting.h>
+#include <logger/QsLog.h>
+#include <logger/QsLogDest.h>
#include "config.h"
using namespace Util::Commandline;
@@ -123,6 +125,9 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
// change directory
QDir::setCurrent(args["dir"].toString());
+ // init the logger
+ initLogger();
+
// load settings
initGlobalSettings();
@@ -156,11 +161,11 @@ MultiMC::~MultiMC()
{
if (m_mmc_translator)
{
- removeTranslator(m_mmc_translator.data());
+ removeTranslator(m_mmc_translator.get());
}
if (m_qt_translator)
{
- removeTranslator(m_qt_translator.data());
+ removeTranslator(m_qt_translator.get());
}
}
@@ -172,7 +177,7 @@ void MultiMC::initTranslations()
{
std::cout << "Loading Qt Language File for "
<< QLocale::system().name().toLocal8Bit().constData() << "...";
- if (!installTranslator(m_qt_translator.data()))
+ if (!installTranslator(m_qt_translator.get()))
{
std::cout << " failed.";
m_qt_translator.reset();
@@ -190,7 +195,7 @@ void MultiMC::initTranslations()
{
std::cout << "Loading MMC Language File for "
<< QLocale::system().name().toLocal8Bit().constData() << "...";
- if (!installTranslator(m_mmc_translator.data()))
+ if (!installTranslator(m_mmc_translator.get()))
{
std::cout << " failed.";
m_mmc_translator.reset();
@@ -203,6 +208,19 @@ void MultiMC::initTranslations()
}
}
+void MultiMC::initLogger()
+{
+ // init the logging mechanism
+ QsLogging::Logger &logger = QsLogging::Logger::instance();
+ logger.setLoggingLevel(QsLogging::TraceLevel);
+ m_fileDestination = QsLogging::DestinationFactory::MakeFileDestination("MultiMC.log");
+ m_debugDestination = QsLogging::DestinationFactory::MakeDebugOutputDestination();
+ logger.addDestination(m_fileDestination.get());
+ logger.addDestination(m_debugDestination.get());
+ // log all the things
+ logger.setLoggingLevel(QsLogging::TraceLevel);
+}
+
void MultiMC::initGlobalSettings()
{
m_settings.reset(new INISettingsObject("multimc.cfg", this));
@@ -275,7 +293,7 @@ void MultiMC::initHttpMetaCache()
m_metacache->Load();
}
-QSharedPointer<IconList> MultiMC::icons()
+std::shared_ptr<IconList> MultiMC::icons()
{
if (!m_icons)
{
@@ -284,7 +302,7 @@ QSharedPointer<IconList> MultiMC::icons()
return m_icons;
}
-QSharedPointer<LWJGLVersionList> MultiMC::lwjgllist()
+std::shared_ptr<LWJGLVersionList> MultiMC::lwjgllist()
{
if (!m_lwjgllist)
{
@@ -293,7 +311,7 @@ QSharedPointer<LWJGLVersionList> MultiMC::lwjgllist()
return m_lwjgllist;
}
-QSharedPointer<ForgeVersionList> MultiMC::forgelist()
+std::shared_ptr<ForgeVersionList> MultiMC::forgelist()
{
if (!m_forgelist)
{
@@ -302,7 +320,7 @@ QSharedPointer<ForgeVersionList> MultiMC::forgelist()
return m_forgelist;
}
-QSharedPointer<MinecraftVersionList> MultiMC::minecraftlist()
+std::shared_ptr<MinecraftVersionList> MultiMC::minecraftlist()
{
if (!m_minecraftlist)
{