Add log_to_file method