diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 7859344b92..631f64d052 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -23,6 +23,7 @@ #include "common/logging/text_formatter.h" #include "common/string_util.h" #include "common/threadsafe_queue.h" +#include "core/settings.h" namespace Log { @@ -152,10 +153,19 @@ FileBackend::FileBackend(const std::string& filename) void FileBackend::Write(const Entry& entry) { // prevent logs from going over the maximum size (in case its spamming and the user doesn't // know) - constexpr std::size_t MAX_BYTES_WRITTEN = 50 * 1024L * 1024L; - if (!file.IsOpen() || bytes_written > MAX_BYTES_WRITTEN) { + constexpr std::size_t MAX_BYTES_WRITTEN = 100 * 1024 * 1024; + constexpr std::size_t MAX_BYTES_WRITTEN_EXTENDED = 1024 * 1024 * 1024; + + if (!file.IsOpen()) { return; } + + if (Settings::values.extended_logging && bytes_written > MAX_BYTES_WRITTEN_EXTENDED) { + return; + } else if (!Settings::values.extended_logging && bytes_written > MAX_BYTES_WRITTEN) { + return; + } + bytes_written += file.WriteString(FormatLogMessage(entry).append(1, '\n')); if (entry.log_level >= Level::Error) { file.Flush(); diff --git a/src/core/settings.h b/src/core/settings.h index 476c3fdf3d..1143aba5d9 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -215,6 +215,7 @@ struct Values { bool reporting_services; bool quest_flag; bool disable_macro_jit; + bool extended_logging; // Misceallaneous std::string log_filter; diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 6fa842cd5e..3c423a2710 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -649,6 +649,8 @@ void Config::ReadDebuggingValues() { Settings::values.quest_flag = ReadSetting(QStringLiteral("quest_flag"), false).toBool(); Settings::values.disable_macro_jit = ReadSetting(QStringLiteral("disable_macro_jit"), false).toBool(); + Settings::values.extended_logging = + ReadSetting(QStringLiteral("extended_logging"), false).toBool(); qt_config->endGroup(); } diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index 2bfe2c3066..027099ab73 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp @@ -41,6 +41,7 @@ void ConfigureDebug::SetConfiguration() { ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug); ui->disable_macro_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn()); ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit); + ui->extended_logging->setChecked(Settings::values.extended_logging); } void ConfigureDebug::ApplyConfiguration() { @@ -53,6 +54,7 @@ void ConfigureDebug::ApplyConfiguration() { Settings::values.quest_flag = ui->quest_flag->isChecked(); Settings::values.renderer_debug = ui->enable_graphics_debugging->isChecked(); Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked(); + Settings::values.extended_logging = ui->extended_logging->isChecked(); Debugger::ToggleConsole(); Log::Filter filter; filter.ParseFilterString(Settings::values.log_filter); diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui index 9d6feb9f73..6f94fe304f 100644 --- a/src/yuzu/configuration/configure_debug.ui +++ b/src/yuzu/configuration/configure_debug.ui @@ -90,7 +90,7 @@ - Show Log Console (Windows Only) + Show Log in Console @@ -103,6 +103,34 @@ + + + + true + + + When checked, the max size of the log increases from 100 MB to 1 GB + + + Enable Extended Logging + + + + + + + + true + + + + This will be reset automatically when yuzu closes. + + + 20 + + + @@ -115,7 +143,7 @@ - + Arguments String @@ -140,8 +168,8 @@ true - - When checked, the graphics API enters in a slower debugging mode + + When checked, the graphics API enters a slower debugging mode Enable Graphics Debugging @@ -153,8 +181,8 @@ true - - When checked, it disables the macro Just In Time compiler. Enabled this makes games run slower + + When checked, it disables the macro Just In Time compiler. Enabling this makes games run slower Disable Macro JIT @@ -169,7 +197,7 @@ Dump - + @@ -178,7 +206,7 @@ - + true @@ -200,7 +228,7 @@ Advanced - +