mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 12:55:45 +00:00
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>
This commit is contained in:
parent
244c07c999
commit
bc55ed496f
4 changed files with 42 additions and 18 deletions
|
@ -4,8 +4,10 @@
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
#include <regex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <fmt/ranges.h>
|
#include <fmt/ranges.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -104,7 +106,19 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes_written += file->WriteString(FormatLogMessage(entry).append(1, '\n'));
|
auto message = FormatLogMessage(entry).append(1, '\n');
|
||||||
|
|
||||||
|
#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
|
// Option to log each line rather than 4k buffers
|
||||||
if (Settings::values.log_flush_lines.GetValue()) {
|
if (Settings::values.log_flush_lines.GetValue()) {
|
||||||
|
|
|
@ -633,6 +633,7 @@ struct Values {
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
Setting<std::string> log_filter{linkage, "*:Info", "log_filter", Category::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> 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> use_dev_keys{linkage, false, "use_dev_keys", Category::Miscellaneous};
|
||||||
Setting<bool> first_launch{linkage, true, "first_launch", Category::Miscellaneous};
|
Setting<bool> first_launch{linkage, true, "first_launch", Category::Miscellaneous};
|
||||||
Setting<bool> hide_pre_alpha_warning{linkage,
|
Setting<bool> hide_pre_alpha_warning{linkage,
|
||||||
|
|
|
@ -40,6 +40,7 @@ void ConfigureDebug::SetConfiguration() {
|
||||||
ui->toggle_console->setChecked(UISettings::values.show_console.GetValue());
|
ui->toggle_console->setChecked(UISettings::values.show_console.GetValue());
|
||||||
ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue()));
|
ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue()));
|
||||||
ui->flush_line->setChecked(Settings::values.log_flush_lines.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(
|
ui->homebrew_args_edit->setText(
|
||||||
QString::fromStdString(Settings::values.program_args.GetValue()));
|
QString::fromStdString(Settings::values.program_args.GetValue()));
|
||||||
ui->fs_access_log->setEnabled(runtime_lock);
|
ui->fs_access_log->setEnabled(runtime_lock);
|
||||||
|
@ -90,6 +91,7 @@ void ConfigureDebug::ApplyConfiguration() {
|
||||||
UISettings::values.show_console = ui->toggle_console->isChecked();
|
UISettings::values.show_console = ui->toggle_console->isChecked();
|
||||||
Settings::values.log_filter = ui->log_filter_edit->text().toStdString();
|
Settings::values.log_filter = ui->log_filter_edit->text().toStdString();
|
||||||
Settings::values.log_flush_lines = ui->flush_line->isChecked();
|
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.program_args = ui->homebrew_args_edit->text().toStdString();
|
||||||
Settings::values.enable_fs_access_log = ui->fs_access_log->isChecked();
|
Settings::values.enable_fs_access_log = ui->fs_access_log->isChecked();
|
||||||
Settings::values.reporting_services = ui->reporting_services->isChecked();
|
Settings::values.reporting_services = ui->reporting_services->isChecked();
|
||||||
|
|
|
@ -474,21 +474,7 @@
|
||||||
<string>Debugging</string>
|
<string>Debugging</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="3" column="0">
|
<item row="7" 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">
|
|
||||||
<spacer name="verticalSpacer_3">
|
<spacer name="verticalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
@ -504,7 +490,7 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QCheckBox" name="dump_audio_commands">
|
<widget class="QCheckBox" name="dump_audio_commands">
|
||||||
<property name="toolTip">
|
<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>
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue