Added function to write to log and csv file on bench