aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksandr Popovich <alekpopo@pm.me>2025-05-19 21:29:22 +0000
committerAlekPop <alekpop@noreply.localhost>2025-05-19 21:29:22 +0000
commitbc55ed496f48f8b9f5ecde3d6dfc35d03912ba2e (patch)
treed2f386813493254cca8c4d4887ba40fc9f82fdaa /src
parent244c07c999c509d05efd2ef9c56af3892f79d079 (diff)
add option to censor the username in logs (#111)
Signed-off-by: Aleksandr Popovich <alekpopo@pm.me> Co-authored-by: Esther1024 <danishreyjavik@outlook.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/111 Co-authored-by: Aleksandr Popovich <alekpopo@pm.me> Co-committed-by: Aleksandr Popovich <alekpopo@pm.me>
Diffstat (limited to 'src')
-rw-r--r--src/common/logging/backend.cpp18
-rw-r--r--src/common/settings.h1
-rw-r--r--src/yuzu/configuration/configure_debug.cpp2
-rw-r--r--src/yuzu/configuration/configure_debug.ui39
4 files changed, 42 insertions, 18 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index e5bf6b723a..ff07ab68eb 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -4,8 +4,10 @@
#include <atomic>
#include <chrono>
#include <climits>
+#include <regex>
#include <thread>
+#include <boost/algorithm/string/replace.hpp>
#include <fmt/ranges.h>
#ifdef _WIN32
@@ -104,9 +106,21 @@ public:
return;
}
- bytes_written += file->WriteString(FormatLogMessage(entry).append(1, '\n'));
+ auto message = FormatLogMessage(entry).append(1, '\n');
- // Option to log each line rather than 4k buffers
+#ifndef ANDROID
+ if (Settings::values.censor_username.GetValue()) {
+ char* username = getenv("USER");
+ if (!username) {
+ username = getenv("USERNAME");
+ }
+ boost::replace_all(message, username, "user");
+ }
+#endif
+
+ bytes_written += file->WriteString(message);
+
+ // Option to log each line rather than 4k buffers
if (Settings::values.log_flush_lines.GetValue()) {
file->Flush();
}
diff --git a/src/common/settings.h b/src/common/settings.h
index 58044103f6..5e0efab8e6 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -633,6 +633,7 @@ struct Values {
// Miscellaneous
Setting<std::string> log_filter{linkage, "*:Info", "log_filter", Category::Miscellaneous};
Setting<bool> log_flush_lines{linkage, false, "flush_lines", Category::Miscellaneous};
+ Setting<bool> censor_username{linkage, true, "censor_username", Category::Miscellaneous};
Setting<bool> use_dev_keys{linkage, false, "use_dev_keys", Category::Miscellaneous};
Setting<bool> first_launch{linkage, true, "first_launch", Category::Miscellaneous};
Setting<bool> hide_pre_alpha_warning{linkage,
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp
index bcb8d1fc5e..10607ee233 100644
--- a/src/yuzu/configuration/configure_debug.cpp
+++ b/src/yuzu/configuration/configure_debug.cpp
@@ -40,6 +40,7 @@ void ConfigureDebug::SetConfiguration() {
ui->toggle_console->setChecked(UISettings::values.show_console.GetValue());
ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue()));
ui->flush_line->setChecked(Settings::values.log_flush_lines.GetValue());
+ ui->censor_username->setChecked(Settings::values.censor_username.GetValue());
ui->homebrew_args_edit->setText(
QString::fromStdString(Settings::values.program_args.GetValue()));
ui->fs_access_log->setEnabled(runtime_lock);
@@ -90,6 +91,7 @@ void ConfigureDebug::ApplyConfiguration() {
UISettings::values.show_console = ui->toggle_console->isChecked();
Settings::values.log_filter = ui->log_filter_edit->text().toStdString();
Settings::values.log_flush_lines = ui->flush_line->isChecked();
+ Settings::values.censor_username = ui->censor_username->isChecked();
Settings::values.program_args = ui->homebrew_args_edit->text().toStdString();
Settings::values.enable_fs_access_log = ui->fs_access_log->isChecked();
Settings::values.reporting_services = ui->reporting_services->isChecked();
diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui
index 3a54d93b7b..155dac412b 100644
--- a/src/yuzu/configuration/configure_debug.ui
+++ b/src/yuzu/configuration/configure_debug.ui
@@ -474,21 +474,7 @@
<string>Debugging</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
- <item row="3" column="0">
- <widget class="QCheckBox" name="reporting_services">
- <property name="text">
- <string>Enable Verbose Reporting Services**</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="fs_access_log">
- <property name="text">
- <string>Enable FS Access Log</string>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
+ <item row="7" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
@@ -504,7 +490,7 @@
</property>
</spacer>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QCheckBox" name="dump_audio_commands">
<property name="toolTip">
<string>Enable this to output the latest generated audio command list to the console. Only affects games using the audio renderer.</string>
@@ -521,6 +507,27 @@
</property>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="fs_access_log">
+ <property name="text">
+ <string>Enable FS Access Log</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="reporting_services">
+ <property name="text">
+ <string>Enable Verbose Reporting Services**</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="censor_username">
+ <property name="text">
+ <string>Censor username in logs</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>