GSRunner: Fix log file writing

Wasn't getting flushed/closed on shutdown.
This commit is contained in:
Stenzek 2023-05-21 16:29:30 +10:00 committed by refractionpcsx2
parent 338a2beaf0
commit 90a6088d61
4 changed files with 14 additions and 5 deletions

View File

@ -644,6 +644,7 @@ int main(int argc, char* argv[])
VMManager::Internal::CPUThreadShutdown(); VMManager::Internal::CPUThreadShutdown();
GSRunner::DestroyPlatformWindow(); GSRunner::DestroyPlatformWindow();
LogSink::CloseFileLog();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -1837,11 +1837,7 @@ int main(int argc, char* argv[])
s_base_settings_interface->Save(); s_base_settings_interface->Save();
// Ensure emulog is flushed. // Ensure emulog is flushed.
if (emuLog) LogSink::CloseFileLog();
{
std::fclose(emuLog);
emuLog = nullptr;
}
return result; return result;
} }

View File

@ -383,6 +383,15 @@ void LogSink::SetFileLogPath(std::string path)
} }
} }
void LogSink::CloseFileLog()
{
if (!emuLog)
return;
std::fclose(emuLog);
emuLog = nullptr;
}
void LogSink::SetBlockSystemConsole(bool block) void LogSink::SetBlockSystemConsole(bool block)
{ {
s_block_system_console = block; s_block_system_console = block;

View File

@ -22,6 +22,9 @@ namespace LogSink
/// Overrides the filename used for the file log. /// Overrides the filename used for the file log.
void SetFileLogPath(std::string path); void SetFileLogPath(std::string path);
/// Ensures file log is flushed and closed.
void CloseFileLog();
/// Prevents the system console from being displayed. /// Prevents the system console from being displayed.
void SetBlockSystemConsole(bool block); void SetBlockSystemConsole(bool block);