Log data to csv at the same time