def FetchLogToFile(self, output_file_path, start_time=None, end_time=None):
    'Gets simulator log via running `log` tool on simulator.\n\n    Args:\n      output_file_path: string, the path of the stdout file.\n      start_time: datetime, the start time of the simulatro log.\n      end_time: datetime, the end time of the simulatro log.\n    '
    command = ['xcrun', 'simctl', 'spawn', self._simulator_id, 'log', 'show', '--style', 'syslog']
    if start_time:
        command.extend(('--start', start_time.strftime('%Y-%m-%d %H:%M:%S')))
    if end_time:
        command.extend(('--end', end_time.strftime('%Y-%m-%d %H:%M:%S')))
    with open(output_file_path, 'w') as stdout_file:
        try:
            subprocess.Popen(command, stdout=stdout_file, stderr=subprocess.STDOUT)
        except ios_errors.SimError as e:
            raise ios_errors.SimError(('Failed to get log on simulator %s: %s' % (self.simulator_id, str(e))))
Gets simulator log via running `log` tool on simulator.

Args:
  output_file_path: string, the path of the stdout file.
  start_time: datetime, the start time of the simulatro log.
  end_time: datetime, the end time of the simulatro log.
def FetchLogToFile(self, output_file_path, start_time=None, end_time=None):
    'Gets simulator log via running `log` tool on simulator.\n\n    Args:\n      output_file_path: string, the path of the stdout file.\n      start_time: datetime, the start time of the simulatro log.\n      end_time: datetime, the end time of the simulatro log.\n    '
    command = ['xcrun', 'simctl', 'spawn', self._simulator_id, 'log', 'show', '--style', 'syslog']
    if start_time:
        command.extend(('--start', start_time.strftime('%Y-%m-%d %H:%M:%S')))
    if end_time:
        command.extend(('--end', end_time.strftime('%Y-%m-%d %H:%M:%S')))
    with open(output_file_path, 'w') as stdout_file:
        try:
            subprocess.Popen(command, stdout=stdout_file, stderr=subprocess.STDOUT)
        except ios_errors.SimError as e:
            raise ios_errors.SimError(('Failed to get log on simulator %s: %s' % (self.simulator_id, str(e))))