Add log to file function