Add option to save logfiles seperate for each game (#2504)

* add option to split log

* better naming

* fix

* fix

* fix formatting

* fix misspelling

* make clang conform

* clang fix
This commit is contained in:
Fire Cube 2025-02-23 21:30:11 +01:00 committed by GitHub
parent 84a614dddc
commit c38e1635ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 108 additions and 76 deletions

View file

@ -66,6 +66,7 @@ static bool vkHostMarkers = false;
static bool vkGuestMarkers = false;
static bool rdocEnable = false;
static bool isFpsColor = true;
static bool isSeparateLogFilesEnabled = false;
static s16 cursorState = HideCursorState::Idle;
static int cursorHideTimeout = 5; // 5 seconds (default)
static bool useUnifiedInputConfig = true;
@ -451,6 +452,10 @@ void setLogFilter(const std::string& type) {
logFilter = type;
}
void setSeparateLogFilesEnabled(bool enabled) {
isSeparateLogFilesEnabled = enabled;
}
void setUserName(const std::string& type) {
userName = type;
}
@ -656,6 +661,10 @@ u32 GetLanguage() {
return m_language;
}
bool getSeparateLogFilesEnabled() {
return isSeparateLogFilesEnabled;
}
int getBackgroundImageOpacity() {
return backgroundImageOpacity;
}
@ -761,6 +770,7 @@ void load(const std::filesystem::path& path) {
const toml::value& debug = data.at("Debug");
isDebugDump = toml::find_or<bool>(debug, "DebugDump", false);
isSeparateLogFilesEnabled = toml::find_or<bool>(debug, "isSeparateLogFilesEnabled", false);
isShaderDebug = toml::find_or<bool>(debug, "CollectShader", false);
isFpsColor = toml::find_or<bool>(debug, "FPSColor", true);
}
@ -887,6 +897,7 @@ void save(const std::filesystem::path& path) {
data["Vulkan"]["rdocEnable"] = rdocEnable;
data["Debug"]["DebugDump"] = isDebugDump;
data["Debug"]["CollectShader"] = isShaderDebug;
data["Debug"]["isSeparateLogFilesEnabled"] = isSeparateLogFilesEnabled;
data["Debug"]["FPSColor"] = isFpsColor;
data["Keys"]["TrophyKey"] = trophyKey;

View file

@ -111,7 +111,8 @@ void setIsMotionControlsEnabled(bool use);
void setLogType(const std::string& type);
void setLogFilter(const std::string& type);
void setSeparateLogFilesEnabled(bool enabled);
bool getSeparateLogFilesEnabled();
void setVkValidation(bool enable);
void setVkSyncValidation(bool enable);
void setRdocEnabled(bool enable);

View file

@ -139,8 +139,9 @@ public:
std::filesystem::create_directory(log_dir);
Filter filter;
filter.ParseFilterString(Config::getLogFilter());
instance = std::unique_ptr<Impl, decltype(&Deleter)>(new Impl(log_dir / LOG_FILE, filter),
Deleter);
const auto& log_file_path = log_file.empty() ? LOG_FILE : log_file;
instance = std::unique_ptr<Impl, decltype(&Deleter)>(
new Impl(log_dir / log_file_path, filter), Deleter);
initialization_in_progress_suppress_logging = false;
}