mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 18:05:46 +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 <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();
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue