mirror of
https://github.com/izzy2lost/xenia-edge.git
synced 2026-07-06 00:20:26 -07:00
[Logging] Remove file logging from the UI process
UI process to only output to consle, game process to log to file
This commit is contained in:
+10
-22
@@ -438,33 +438,21 @@ void InitializeLogging(const std::string_view app_name, bool is_game_process) {
|
||||
logger_->AddLogSink(std::make_unique<AndroidLogSink>(app_name));
|
||||
}
|
||||
#else
|
||||
FILE* log_file = nullptr;
|
||||
if (cvars::log_file.empty()) {
|
||||
// Default log file name based on process type
|
||||
std::string file_name;
|
||||
if (is_game_process) {
|
||||
file_name = fmt::format("{}_game.log", app_name);
|
||||
// Only enable file logging for game processes, not the UI process
|
||||
if (is_game_process) {
|
||||
FILE* log_file = nullptr;
|
||||
if (cvars::log_file.empty()) {
|
||||
// Default log file name for game process
|
||||
std::string file_name = fmt::format("{}.log", app_name);
|
||||
auto file_path = xe::filesystem::GetExecutableFolder() / file_name;
|
||||
log_file = xe::filesystem::OpenFile(file_path, "wt");
|
||||
} else {
|
||||
file_name = fmt::format("{}.log", app_name);
|
||||
}
|
||||
auto file_path = xe::filesystem::GetExecutableFolder() / file_name;
|
||||
log_file = xe::filesystem::OpenFile(file_path, "wt");
|
||||
} else {
|
||||
// User specified log file
|
||||
if (is_game_process) {
|
||||
// Game process with explicit log file - prepend "game_"
|
||||
std::filesystem::path log_path(cvars::log_file);
|
||||
std::string filename = "game_" + log_path.filename().string();
|
||||
auto modified_path = log_path.parent_path() / filename;
|
||||
xe::filesystem::CreateParentFolder(modified_path);
|
||||
log_file = xe::filesystem::OpenFile(modified_path, "wt");
|
||||
} else {
|
||||
// UI process uses log file as-is
|
||||
// User specified log file - use as-is for game process
|
||||
xe::filesystem::CreateParentFolder(cvars::log_file);
|
||||
log_file = xe::filesystem::OpenFile(cvars::log_file, "wt");
|
||||
}
|
||||
logger_->AddLogSink(std::make_unique<FileLogSink>(log_file, true));
|
||||
}
|
||||
logger_->AddLogSink(std::make_unique<FileLogSink>(log_file, true));
|
||||
|
||||
if (cvars::log_to_stdout) {
|
||||
logger_->AddLogSink(std::make_unique<FileLogSink>(stdout, false));
|
||||
|
||||
@@ -116,9 +116,9 @@ bool ParseWin32LaunchArguments(
|
||||
return true;
|
||||
}
|
||||
|
||||
int InitializeWin32App(const std::string_view app_name) {
|
||||
int InitializeWin32App(const std::string_view app_name, bool is_game_process) {
|
||||
// Initialize logging. Needs parsed FLAGS.
|
||||
xe::InitializeLogging(app_name);
|
||||
xe::InitializeLogging(app_name, is_game_process);
|
||||
|
||||
// Print version info.
|
||||
XELOGI(
|
||||
|
||||
@@ -21,7 +21,8 @@ bool ParseWin32LaunchArguments(
|
||||
const std::vector<std::string>& positional_options,
|
||||
std::vector<std::string>* args_out);
|
||||
// InitializeWin32App uses cvars, call ParseWin32LaunchArguments before.
|
||||
int InitializeWin32App(const std::string_view app_name);
|
||||
int InitializeWin32App(const std::string_view app_name,
|
||||
bool is_game_process = false);
|
||||
void ShutdownWin32App();
|
||||
|
||||
} // namespace xe
|
||||
|
||||
@@ -246,9 +246,9 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
// Use Windows-specific initialization which properly sets up logging
|
||||
xe::InitializeWin32App(app->GetName());
|
||||
xe::InitializeWin32App(app->GetName(), is_game_process);
|
||||
#else
|
||||
xe::InitializeLogging(app->GetName());
|
||||
xe::InitializeLogging(app->GetName(), is_game_process);
|
||||
#endif
|
||||
|
||||
if (app->OnInitialize()) {
|
||||
|
||||
Reference in New Issue
Block a user