diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2014-10-28 08:36:00 +0100 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2014-12-13 04:59:52 +0100 |
commit | 616d87444313db865c60fbeee36ebe5250ef301e (patch) | |
tree | fb99bf8bebfdf8c825c5d3e4f01fb4779ceaba68 /src/citra | |
parent | Add SCOPE_EXIT macro to conveniently execute cleanup actions (diff) | |
download | yuzu-616d87444313db865c60fbeee36ebe5250ef301e.tar yuzu-616d87444313db865c60fbeee36ebe5250ef301e.tar.gz yuzu-616d87444313db865c60fbeee36ebe5250ef301e.tar.bz2 yuzu-616d87444313db865c60fbeee36ebe5250ef301e.tar.lz yuzu-616d87444313db865c60fbeee36ebe5250ef301e.tar.xz yuzu-616d87444313db865c60fbeee36ebe5250ef301e.tar.zst yuzu-616d87444313db865c60fbeee36ebe5250ef301e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/citra/citra.cpp | 16 | ||||
-rw-r--r-- | src/citra_qt/main.cpp | 18 |
2 files changed, 26 insertions, 8 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index f2aeb510e..7c031ce8d 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -2,8 +2,12 @@ // Licensed under GPLv2 // Refer to the license.txt file included. +#include <thread> + #include "common/common.h" -#include "common/log_manager.h" +#include "common/logging/text_formatter.h" +#include "common/logging/backend.h" +#include "common/scope_exit.h" #include "core/settings.h" #include "core/system.h" @@ -15,7 +19,12 @@ /// Application entry point int __cdecl main(int argc, char **argv) { - LogManager::Init(); + std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger(); + std::thread logging_thread(Log::TextLoggingLoop, logger); + SCOPE_EXIT({ + logger->Close(); + logging_thread.join(); + }); if (argc < 2) { ERROR_LOG(BOOT, "Failed to load ROM: No ROM specified"); @@ -24,9 +33,6 @@ int __cdecl main(int argc, char **argv) { Config config; - if (!Settings::values.enable_log) - LogManager::Shutdown(); - std::string boot_filename = argv[1]; EmuWindow_GLFW* emu_window = new EmuWindow_GLFW; diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index b4e3ad964..2e3025295 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -1,3 +1,5 @@ +#include <thread> + #include <QtGui> #include <QDesktopWidget> #include <QFileDialog> @@ -5,8 +7,13 @@ #include "main.hxx" #include "common/common.h" -#include "common/platform.h" #include "common/log_manager.h" +#include "common/logging/text_formatter.h" +#include "common/logging/log.h" +#include "common/logging/backend.h" +#include "common/platform.h" +#include "common/scope_exit.h" + #if EMU_PLATFORM == PLATFORM_LINUX #include <unistd.h> #endif @@ -33,10 +40,8 @@ #include "version.h" - GMainWindow::GMainWindow() { - LogManager::Init(); Pica::g_debug_context = Pica::DebugContext::Construct(); @@ -271,6 +276,13 @@ void GMainWindow::closeEvent(QCloseEvent* event) int __cdecl main(int argc, char* argv[]) { + std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger(); + std::thread logging_thread(Log::TextLoggingLoop, logger); + SCOPE_EXIT({ + logger->Close(); + logging_thread.join(); + }); + QApplication::setAttribute(Qt::AA_X11InitThreads); QApplication app(argc, argv); GMainWindow main_window; |