Added a read and write to log function