RobotStudio event

Log file for last position

Hello,

I was wondering if there was a way for RobotStudio/RAPID to write some sort of log file of: its current position in space and/or its last position? So that if an error occurs and the program stops, I know where the robot was last at in space rather than having to start from the initial position.

Thanks,
SM