refactor(cloudcmd) writeLogsToFile