summaryrefslogtreecommitdiff
path: root/src/yuzu/debugger/console.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-08-22 20:40:18 -0700
committerGitHub <noreply@github.com>2021-08-22 20:40:18 -0700
commitf65f8b909773ba79f54423c7d5d5eb1653cb7733 (patch)
tree3e851ea4e3bf6a353dba89029ab087709d33e366 /src/yuzu/debugger/console.cpp
parenta428a843cbefc4da84d268f6ac4a8f6878992647 (diff)
parent001675dced1b7b751d1db4f0d6490776c613df2f (diff)
Merge pull request #6869 from yzct12345/shiny-logs-in-the-fireplace
logging: Simplify and make thread-safe
Diffstat (limited to 'src/yuzu/debugger/console.cpp')
-rw-r--r--src/yuzu/debugger/console.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/yuzu/debugger/console.cpp b/src/yuzu/debugger/console.cpp
index 22ca1285d..f89ea8ea7 100644
--- a/src/yuzu/debugger/console.cpp
+++ b/src/yuzu/debugger/console.cpp
@@ -21,6 +21,7 @@ void ToggleConsole() {
console_shown = UISettings::values.show_console.GetValue();
}
+ using namespace Common::Log;
#if defined(_WIN32) && !defined(_DEBUG)
FILE* temp;
if (UISettings::values.show_console) {
@@ -29,24 +30,20 @@ void ToggleConsole() {
freopen_s(&temp, "CONIN$", "r", stdin);
freopen_s(&temp, "CONOUT$", "w", stdout);
freopen_s(&temp, "CONOUT$", "w", stderr);
- Common::Log::AddBackend(std::make_unique<Common::Log::ColorConsoleBackend>());
+ SetColorConsoleBackendEnabled(true);
}
} else {
if (FreeConsole()) {
// In order to close the console, we have to also detach the streams on it.
// Just redirect them to NUL if there is no console window
- Common::Log::RemoveBackend(Common::Log::ColorConsoleBackend::Name());
+ SetColorConsoleBackendEnabled(false);
freopen_s(&temp, "NUL", "r", stdin);
freopen_s(&temp, "NUL", "w", stdout);
freopen_s(&temp, "NUL", "w", stderr);
}
}
#else
- if (UISettings::values.show_console) {
- Common::Log::AddBackend(std::make_unique<Common::Log::ColorConsoleBackend>());
- } else {
- Common::Log::RemoveBackend(Common::Log::ColorConsoleBackend::Name());
- }
+ SetColorConsoleBackendEnabled(UISettings::values.show_console.GetValue());
#endif
}
} // namespace Debugger