I can get the log directory of my game with FPaths::ProjectLogDir()
,
but how can I get the file name of log file, e.g., MyGame.log
?
The file name may usually be just MyGame.log
, of course,
but sometimes it could be MyGame_2.log
, or MyGame_3.log
,
if other game processes are running on the same machine simultaneously.
I need to know each log file name per game process.
Thanks. (*)
FPlatformOutputDevices::GetAbsoluteLogFilename()
does’t work. it always returns MyGame.log
only.
Just for Windows
platform:
#if PLATFORM_WINDOWS
FString LogFile;
FOutputDevice* OutputDevice = FGenericPlatformOutputDevices::GetLog();
if (OutputDevice != nullptr)
{
FOutputDeviceFile* OutputDeviceFile =
static_cast<FOutputDeviceFile*>(OutputDevice);
LogFile = OutputDeviceFile->GetFilename();
}
#endif // PLATFORM_WINDOWS
I’m not sure whether it would be working for any other platforms.