summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar M&M2020-07-29 10:25:37 -0700
committerGravatar M&M2020-08-24 21:39:56 -0700
commit43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c (patch)
tree3eb2d533a8edd88b54934aa35371fa7fb9d7bc30
parentMerge pull request #4542 from ReinUsesLisp/gpu-init-base (diff)
downloadyuzu-43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c.tar.gz
yuzu-43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c.tar.xz
yuzu-43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c.zip
logging/settings: Increase maximum log size to 100 MB and add extended logging option
The extended logging option is automatically disabled on boot but can be enabled afterwards, allowing the log file to go up to 1 GB during that session. This commit also fixes a few errors that are present in the general debug menu.
Diffstat (limited to '')
-rw-r--r--src/common/logging/backend.cpp14
-rw-r--r--src/core/settings.h1
-rw-r--r--src/yuzu/configuration/config.cpp2
-rw-r--r--src/yuzu/configuration/configure_debug.cpp2
-rw-r--r--src/yuzu/configuration/configure_debug.ui46
5 files changed, 54 insertions, 11 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index 62cfde397..fdb2e52fa 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -23,6 +23,7 @@
23#include "common/logging/text_formatter.h" 23#include "common/logging/text_formatter.h"
24#include "common/string_util.h" 24#include "common/string_util.h"
25#include "common/threadsafe_queue.h" 25#include "common/threadsafe_queue.h"
26#include "core/settings.h"
26 27
27namespace Log { 28namespace Log {
28 29
@@ -152,10 +153,19 @@ FileBackend::FileBackend(const std::string& filename)
152void FileBackend::Write(const Entry& entry) { 153void FileBackend::Write(const Entry& entry) {
153 // prevent logs from going over the maximum size (in case its spamming and the user doesn't 154 // prevent logs from going over the maximum size (in case its spamming and the user doesn't
154 // know) 155 // know)
155 constexpr std::size_t MAX_BYTES_WRITTEN = 50 * 1024L * 1024L; 156 constexpr std::size_t MAX_BYTES_WRITTEN = 100 * 1024 * 1024;
156 if (!file.IsOpen() || bytes_written > MAX_BYTES_WRITTEN) { 157 constexpr std::size_t MAX_BYTES_WRITTEN_EXTENDED = 1024 * 1024 * 1024;
158
159 if (!file.IsOpen()) {
160 return;
161 }
162
163 if (Settings::values.extended_logging && bytes_written > MAX_BYTES_WRITTEN_EXTENDED) {
164 return;
165 } else if (!Settings::values.extended_logging && bytes_written > MAX_BYTES_WRITTEN) {
157 return; 166 return;
158 } 167 }
168
159 bytes_written += file.WriteString(FormatLogMessage(entry).append(1, '\n')); 169 bytes_written += file.WriteString(FormatLogMessage(entry).append(1, '\n'));
160 if (entry.log_level >= Level::Error) { 170 if (entry.log_level >= Level::Error) {
161 file.Flush(); 171 file.Flush();
diff --git a/src/core/settings.h b/src/core/settings.h
index 3681b5e9d..5a2f852fd 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -498,6 +498,7 @@ struct Values {
498 bool reporting_services; 498 bool reporting_services;
499 bool quest_flag; 499 bool quest_flag;
500 bool disable_macro_jit; 500 bool disable_macro_jit;
501 bool extended_logging;
501 502
502 // Misceallaneous 503 // Misceallaneous
503 std::string log_filter; 504 std::string log_filter;
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 7af974d8d..1d4816d34 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -523,6 +523,8 @@ void Config::ReadDebuggingValues() {
523 Settings::values.quest_flag = ReadSetting(QStringLiteral("quest_flag"), false).toBool(); 523 Settings::values.quest_flag = ReadSetting(QStringLiteral("quest_flag"), false).toBool();
524 Settings::values.disable_macro_jit = 524 Settings::values.disable_macro_jit =
525 ReadSetting(QStringLiteral("disable_macro_jit"), false).toBool(); 525 ReadSetting(QStringLiteral("disable_macro_jit"), false).toBool();
526 Settings::values.extended_logging =
527 ReadSetting(QStringLiteral("extended_logging"), false).toBool();
526 528
527 qt_config->endGroup(); 529 qt_config->endGroup();
528} 530}
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp
index 2bfe2c306..027099ab7 100644
--- a/src/yuzu/configuration/configure_debug.cpp
+++ b/src/yuzu/configuration/configure_debug.cpp
@@ -41,6 +41,7 @@ void ConfigureDebug::SetConfiguration() {
41 ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug); 41 ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug);
42 ui->disable_macro_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn()); 42 ui->disable_macro_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
43 ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit); 43 ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit);
44 ui->extended_logging->setChecked(Settings::values.extended_logging);
44} 45}
45 46
46void ConfigureDebug::ApplyConfiguration() { 47void ConfigureDebug::ApplyConfiguration() {
@@ -53,6 +54,7 @@ void ConfigureDebug::ApplyConfiguration() {
53 Settings::values.quest_flag = ui->quest_flag->isChecked(); 54 Settings::values.quest_flag = ui->quest_flag->isChecked();
54 Settings::values.renderer_debug = ui->enable_graphics_debugging->isChecked(); 55 Settings::values.renderer_debug = ui->enable_graphics_debugging->isChecked();
55 Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked(); 56 Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked();
57 Settings::values.extended_logging = ui->extended_logging->isChecked();
56 Debugger::ToggleConsole(); 58 Debugger::ToggleConsole();
57 Log::Filter filter; 59 Log::Filter filter;
58 filter.ParseFilterString(Settings::values.log_filter); 60 filter.ParseFilterString(Settings::values.log_filter);
diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui
index 9d6feb9f7..6f94fe304 100644
--- a/src/yuzu/configuration/configure_debug.ui
+++ b/src/yuzu/configuration/configure_debug.ui
@@ -90,7 +90,7 @@
90 <item> 90 <item>
91 <widget class="QCheckBox" name="toggle_console"> 91 <widget class="QCheckBox" name="toggle_console">
92 <property name="text"> 92 <property name="text">
93 <string>Show Log Console (Windows Only)</string> 93 <string>Show Log in Console</string>
94 </property> 94 </property>
95 </widget> 95 </widget>
96 </item> 96 </item>
@@ -103,6 +103,34 @@
103 </item> 103 </item>
104 </layout> 104 </layout>
105 </item> 105 </item>
106 <item>
107 <widget class="QCheckBox" name="extended_logging">
108 <property name="enabled">
109 <bool>true</bool>
110 </property>
111 <property name="toolTip">
112 <string>When checked, the max size of the log increases from 100 MB to 1 GB</string>
113 </property>
114 <property name="text">
115 <string>Enable Extended Logging</string>
116 </property>
117 </widget>
118 </item>
119 <item>
120 <widget class="QLabel" name="label_3">
121 <property name="font">
122 <font>
123 <italic>true</italic>
124 </font>
125 </property>
126 <property name="text">
127 <string>This will be reset automatically when yuzu closes.</string>
128 </property>
129 <property name="indent">
130 <number>20</number>
131 </property>
132 </widget>
133 </item>
106 </layout> 134 </layout>
107 </widget> 135 </widget>
108 </item> 136 </item>
@@ -115,7 +143,7 @@
115 <item> 143 <item>
116 <layout class="QHBoxLayout" name="horizontalLayout_4"> 144 <layout class="QHBoxLayout" name="horizontalLayout_4">
117 <item> 145 <item>
118 <widget class="QLabel" name="label_3"> 146 <widget class="QLabel" name="label_4">
119 <property name="text"> 147 <property name="text">
120 <string>Arguments String</string> 148 <string>Arguments String</string>
121 </property> 149 </property>
@@ -140,8 +168,8 @@
140 <property name="enabled"> 168 <property name="enabled">
141 <bool>true</bool> 169 <bool>true</bool>
142 </property> 170 </property>
143 <property name="whatsThis"> 171 <property name="toolTip">
144 <string>When checked, the graphics API enters in a slower debugging mode</string> 172 <string>When checked, the graphics API enters a slower debugging mode</string>
145 </property> 173 </property>
146 <property name="text"> 174 <property name="text">
147 <string>Enable Graphics Debugging</string> 175 <string>Enable Graphics Debugging</string>
@@ -153,8 +181,8 @@
153 <property name="enabled"> 181 <property name="enabled">
154 <bool>true</bool> 182 <bool>true</bool>
155 </property> 183 </property>
156 <property name="whatsThis"> 184 <property name="toolTip">
157 <string>When checked, it disables the macro Just In Time compiler. Enabled this makes games run slower</string> 185 <string>When checked, it disables the macro Just In Time compiler. Enabling this makes games run slower</string>
158 </property> 186 </property>
159 <property name="text"> 187 <property name="text">
160 <string>Disable Macro JIT</string> 188 <string>Disable Macro JIT</string>
@@ -169,7 +197,7 @@
169 <property name="title"> 197 <property name="title">
170 <string>Dump</string> 198 <string>Dump</string>
171 </property> 199 </property>
172 <layout class="QVBoxLayout" name="verticalLayout_6"> 200 <layout class="QVBoxLayout" name="verticalLayout_7">
173 <item> 201 <item>
174 <widget class="QCheckBox" name="reporting_services"> 202 <widget class="QCheckBox" name="reporting_services">
175 <property name="text"> 203 <property name="text">
@@ -178,7 +206,7 @@
178 </widget> 206 </widget>
179 </item> 207 </item>
180 <item> 208 <item>
181 <widget class="QLabel" name="label"> 209 <widget class="QLabel" name="label_5">
182 <property name="font"> 210 <property name="font">
183 <font> 211 <font>
184 <italic>true</italic> 212 <italic>true</italic>
@@ -200,7 +228,7 @@
200 <property name="title"> 228 <property name="title">
201 <string>Advanced</string> 229 <string>Advanced</string>
202 </property> 230 </property>
203 <layout class="QVBoxLayout" name="verticalLayout_7"> 231 <layout class="QVBoxLayout" name="verticalLayout_8">
204 <item> 232 <item>
205 <widget class="QCheckBox" name="quest_flag"> 233 <widget class="QCheckBox" name="quest_flag">
206 <property name="text"> 234 <property name="text">