From 616d87444313db865c60fbeee36ebe5250ef301e Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Tue, 28 Oct 2014 05:36:00 -0200 Subject: New logging system --- src/citra_qt/main.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/citra_qt/main.cpp') 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 + #include #include #include @@ -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 #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 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; -- cgit v1.2.3 From 0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Fri, 5 Dec 2014 23:53:49 -0200 Subject: Convert old logging calls to new logging macros --- src/citra_qt/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/citra_qt/main.cpp') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 2e3025295..5293263cd 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -158,18 +158,18 @@ GMainWindow::~GMainWindow() void GMainWindow::BootGame(std::string filename) { - NOTICE_LOG(MASTER_LOG, "Citra starting...\n"); + LOG_INFO(Frontend, "Citra starting...\n"); System::Init(render_window); if (Core::Init()) { - ERROR_LOG(MASTER_LOG, "Core initialization failed, exiting..."); + LOG_CRITICAL(Frontend, "Core initialization failed, exiting..."); Core::Stop(); exit(1); } // Load a game or die... if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) { - ERROR_LOG(BOOT, "Failed to load ROM!"); + LOG_CRITICAL(Frontend, "Failed to load ROM!"); } disasmWidget->Init(); -- cgit v1.2.3 From 0e0a007a2503d468391004c8ea2faae305232345 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 6 Dec 2014 20:00:08 -0200 Subject: Add configurable per-class log filtering --- src/citra_qt/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/citra_qt/main.cpp') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 5293263cd..817732167 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -11,6 +11,7 @@ #include "common/logging/text_formatter.h" #include "common/logging/log.h" #include "common/logging/backend.h" +#include "common/logging/filter.h" #include "common/platform.h" #include "common/scope_exit.h" @@ -42,14 +43,10 @@ GMainWindow::GMainWindow() { - Pica::g_debug_context = Pica::DebugContext::Construct(); Config config; - if (!Settings::values.enable_log) - LogManager::Shutdown(); - ui.setupUi(this); statusBar()->hide(); @@ -277,7 +274,8 @@ void GMainWindow::closeEvent(QCloseEvent* event) int __cdecl main(int argc, char* argv[]) { std::shared_ptr logger = Log::InitGlobalLogger(); - std::thread logging_thread(Log::TextLoggingLoop, logger); + Log::Filter log_filter(Log::Level::Info); + std::thread logging_thread(Log::TextLoggingLoop, logger, &log_filter); SCOPE_EXIT({ logger->Close(); logging_thread.join(); @@ -285,7 +283,11 @@ int __cdecl main(int argc, char* argv[]) QApplication::setAttribute(Qt::AA_X11InitThreads); QApplication app(argc, argv); + GMainWindow main_window; + // After settings have been loaded by GMainWindow, apply the filter + log_filter.ParseFilterString(Settings::values.log_filter); + main_window.show(); return app.exec(); } -- cgit v1.2.3 From 4d2a6f8b9b3eeb85574a5e4f93422ffd4feebcd3 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 6 Dec 2014 21:14:14 -0200 Subject: Remove old logging system --- src/citra_qt/main.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/citra_qt/main.cpp') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 817732167..1299338ac 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -7,7 +7,6 @@ #include "main.hxx" #include "common/common.h" -#include "common/log_manager.h" #include "common/logging/text_formatter.h" #include "common/logging/log.h" #include "common/logging/backend.h" -- cgit v1.2.3