Implemented log_file writing