Implemented ofstream into data logging