summaryrefslogtreecommitdiffstats
path: root/src/citra
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/citra/citra.cpp23
-rw-r--r--src/citra/config.cpp8
-rw-r--r--src/citra/default_ini.h2
-rw-r--r--src/citra/emu_window/emu_window_glfw.cpp16
-rw-r--r--src/citra_qt/bootmanager.cpp8
-rw-r--r--src/citra_qt/config.cpp4
-rw-r--r--src/citra_qt/debugger/graphics_breakpoints.cpp2
-rw-r--r--src/citra_qt/main.cpp33
-rw-r--r--src/citra_qt/util/spinbox.cpp2
9 files changed, 60 insertions, 38 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index f2aeb510e..d6e8a4ec7 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -2,8 +2,13 @@
// 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/logging/filter.h"
+#include "common/scope_exit.h"
#include "core/settings.h"
#include "core/system.h"
@@ -15,17 +20,21 @@
/// Application entry point
int __cdecl main(int argc, char **argv) {
- LogManager::Init();
+ std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger();
+ Log::Filter log_filter(Log::Level::Debug);
+ std::thread logging_thread(Log::TextLoggingLoop, logger, &log_filter);
+ SCOPE_EXIT({
+ logger->Close();
+ logging_thread.join();
+ });
if (argc < 2) {
- ERROR_LOG(BOOT, "Failed to load ROM: No ROM specified");
+ LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
return -1;
}
Config config;
-
- if (!Settings::values.enable_log)
- LogManager::Shutdown();
+ log_filter.ParseFilterString(Settings::values.log_filter);
std::string boot_filename = argv[1];
EmuWindow_GLFW* emu_window = new EmuWindow_GLFW;
@@ -34,7 +43,7 @@ int __cdecl main(int argc, char **argv) {
Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
if (Loader::ResultStatus::Success != load_result) {
- ERROR_LOG(BOOT, "Failed to load ROM (Error %i)!", load_result);
+ LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result);
return -1;
}
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index 1f8f5922b..92764809e 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -22,17 +22,17 @@ Config::Config() {
bool Config::LoadINI(INIReader* config, const char* location, const std::string& default_contents, bool retry) {
if (config->ParseError() < 0) {
if (retry) {
- ERROR_LOG(CONFIG, "Failed to load %s. Creating file from defaults...", location);
+ LOG_WARNING(Config, "Failed to load %s. Creating file from defaults...", location);
FileUtil::CreateFullPath(location);
FileUtil::WriteStringToFile(true, default_contents, location);
*config = INIReader(location); // Reopen file
return LoadINI(config, location, default_contents, false);
}
- ERROR_LOG(CONFIG, "Failed.");
+ LOG_ERROR(Config, "Failed.");
return false;
}
- INFO_LOG(CONFIG, "Successfully loaded %s", location);
+ LOG_INFO(Config, "Successfully loaded %s", location);
return true;
}
@@ -64,7 +64,7 @@ void Config::ReadValues() {
Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true);
// Miscellaneous
- Settings::values.enable_log = glfw_config->GetBoolean("Miscellaneous", "enable_log", true);
+ Settings::values.log_filter = glfw_config->Get("Miscellaneous", "log_filter", "*:Info");
}
void Config::Reload() {
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
index f1f626eed..7cf543e07 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -34,7 +34,7 @@ gpu_refresh_rate = ## 60 (default)
use_virtual_sd =
[Miscellaneous]
-enable_log =
+log_filter = *:Info ## Examples: *:Debug Kernel.SVC:Trace Service.*:Critical
)";
}
diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp
index 982619126..929e09f43 100644
--- a/src/citra/emu_window/emu_window_glfw.cpp
+++ b/src/citra/emu_window/emu_window_glfw.cpp
@@ -36,15 +36,15 @@ const bool EmuWindow_GLFW::IsOpen() {
}
void EmuWindow_GLFW::OnFramebufferResizeEvent(GLFWwindow* win, int width, int height) {
- _dbg_assert_(GUI, width > 0);
- _dbg_assert_(GUI, height > 0);
+ _dbg_assert_(Frontend, width > 0);
+ _dbg_assert_(Frontend, height > 0);
GetEmuWindow(win)->NotifyFramebufferSizeChanged(std::pair<unsigned,unsigned>(width, height));
}
void EmuWindow_GLFW::OnClientAreaResizeEvent(GLFWwindow* win, int width, int height) {
- _dbg_assert_(GUI, width > 0);
- _dbg_assert_(GUI, height > 0);
+ _dbg_assert_(Frontend, width > 0);
+ _dbg_assert_(Frontend, height > 0);
// NOTE: GLFW provides no proper way to set a minimal window size.
// Hence, we just ignore the corresponding EmuWindow hint.
@@ -59,12 +59,12 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
ReloadSetKeymaps();
glfwSetErrorCallback([](int error, const char *desc){
- ERROR_LOG(GUI, "GLFW 0x%08x: %s", error, desc);
+ LOG_ERROR(Frontend, "GLFW 0x%08x: %s", error, desc);
});
// Initialize the window
if(glfwInit() != GL_TRUE) {
- ERROR_LOG(GUI, "Failed to initialize GLFW! Exiting...");
+ LOG_CRITICAL(Frontend, "Failed to initialize GLFW! Exiting...");
exit(1);
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
@@ -79,7 +79,7 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
window_title.c_str(), nullptr, nullptr);
if (m_render_window == nullptr) {
- ERROR_LOG(GUI, "Failed to create GLFW window! Exiting...");
+ LOG_CRITICAL(Frontend, "Failed to create GLFW window! Exiting...");
exit(1);
}
@@ -149,7 +149,7 @@ void EmuWindow_GLFW::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,u
std::pair<int,int> current_size;
glfwGetWindowSize(m_render_window, &current_size.first, &current_size.second);
- _dbg_assert_(GUI, (int)minimal_size.first > 0 && (int)minimal_size.second > 0);
+ _dbg_assert_(Frontend, (int)minimal_size.first > 0 && (int)minimal_size.second > 0);
int new_width = std::max(current_size.first, (int)minimal_size.first);
int new_height = std::max(current_size.second, (int)minimal_size.second);
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index b53206be6..6d08d6afc 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -62,7 +62,7 @@ void EmuThread::Stop()
{
if (!isRunning())
{
- INFO_LOG(MASTER_LOG, "EmuThread::Stop called while emu thread wasn't running, returning...");
+ LOG_WARNING(Frontend, "EmuThread::Stop called while emu thread wasn't running, returning...");
return;
}
stop_run = true;
@@ -76,7 +76,7 @@ void EmuThread::Stop()
wait(1000);
if (isRunning())
{
- WARN_LOG(MASTER_LOG, "EmuThread still running, terminating...");
+ LOG_WARNING(Frontend, "EmuThread still running, terminating...");
quit();
// TODO: Waiting 50 seconds can be necessary if the logging subsystem has a lot of spam
@@ -84,11 +84,11 @@ void EmuThread::Stop()
wait(50000);
if (isRunning())
{
- WARN_LOG(MASTER_LOG, "EmuThread STILL running, something is wrong here...");
+ LOG_CRITICAL(Frontend, "EmuThread STILL running, something is wrong here...");
terminate();
}
}
- INFO_LOG(MASTER_LOG, "EmuThread stopped");
+ LOG_INFO(Frontend, "EmuThread stopped");
}
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 3209e5900..0ae6b8b2d 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -52,7 +52,7 @@ void Config::ReadValues() {
qt_config->endGroup();
qt_config->beginGroup("Miscellaneous");
- Settings::values.enable_log = qt_config->value("enable_log", true).toBool();
+ Settings::values.log_filter = qt_config->value("log_filter", "*:Info").toString().toStdString();
qt_config->endGroup();
}
@@ -87,7 +87,7 @@ void Config::SaveValues() {
qt_config->endGroup();
qt_config->beginGroup("Miscellaneous");
- qt_config->setValue("enable_log", Settings::values.enable_log);
+ qt_config->setValue("log_filter", QString::fromStdString(Settings::values.log_filter));
qt_config->endGroup();
}
diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp
index df5579e15..53394b6e6 100644
--- a/src/citra_qt/debugger/graphics_breakpoints.cpp
+++ b/src/citra_qt/debugger/graphics_breakpoints.cpp
@@ -45,7 +45,7 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const
map.insert({Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch")});
map.insert({Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")});
- _dbg_assert_(GUI, map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents));
+ _dbg_assert_(Debug_GPU, map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents));
return map[event];
}
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index b4e3ad964..1299338ac 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/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/log_manager.h"
+#include "common/scope_exit.h"
+
#if EMU_PLATFORM == PLATFORM_LINUX
#include <unistd.h>
#endif
@@ -33,18 +40,12 @@
#include "version.h"
-
GMainWindow::GMainWindow()
{
- LogManager::Init();
-
Pica::g_debug_context = Pica::DebugContext::Construct();
Config config;
- if (!Settings::values.enable_log)
- LogManager::Shutdown();
-
ui.setupUi(this);
statusBar()->hide();
@@ -153,18 +154,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();
@@ -271,9 +272,21 @@ void GMainWindow::closeEvent(QCloseEvent* event)
int __cdecl main(int argc, char* argv[])
{
+ std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger();
+ Log::Filter log_filter(Log::Level::Info);
+ std::thread logging_thread(Log::TextLoggingLoop, logger, &log_filter);
+ SCOPE_EXIT({
+ logger->Close();
+ logging_thread.join();
+ });
+
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();
}
diff --git a/src/citra_qt/util/spinbox.cpp b/src/citra_qt/util/spinbox.cpp
index 80dc67d7d..9672168f5 100644
--- a/src/citra_qt/util/spinbox.cpp
+++ b/src/citra_qt/util/spinbox.cpp
@@ -244,7 +244,7 @@ QValidator::State CSpinBox::validate(QString& input, int& pos) const
if (strpos >= input.length() - HasSign() - suffix.length())
return QValidator::Intermediate;
- _dbg_assert_(GUI, base <= 10 || base == 16);
+ _dbg_assert_(Frontend, base <= 10 || base == 16);
QString regexp;
// Demand sign character for negative ranges