'Download the requested logs.
This will write the logs to the file designated by
self.output_file, or to stdout if the filename is \'-\'.
Multiple roundtrips to the server may be made.'

def DownloadLogs(self):

    if self.module:
        StatusUpdate(('Downloading    request    logs    for    app    %s    module    %s    version    %s.' % (self.app_id, self.module, self.version_id)), self.error_fh)
    else:
        StatusUpdate(('Downloading    request    logs    for    app    %s    version    %s.' % (self.app_id, self.version_id)), self.error_fh)
    tf = tempfile.TemporaryFile()
    last_offset = None
    try:
        while True:
            try:
                new_offset = self.RequestLogLines(tf, last_offset)
                if ((not new_offset) or (new_offset == last_offset)):
                    break
                last_offset = new_offset
            except KeyboardInterrupt:
                StatusUpdate('Keyboard    interrupt;    saving    data    downloaded    so    far.', self.error_fh)
                break
        StatusUpdate(('Copying    request    logs    to    %r.' % self.output_file), self.error_fh)
        if (self.output_file == '-'):
            of = sys.stdout
        else:
            try:
                of = open(self.output_file, self.write_mode)
            except IOError as err:
                StatusUpdate(("Can't    write    %r:    %s." % (self.output_file, err)))
                sys.exit(1)
        try:
            line_count = CopyReversedLines(tf, of)
        finally:
            of.flush()
            if (of is not sys.stdout):
                of.close()
    finally:
        tf.close()
    StatusUpdate(('Copied    %d    records.' % line_count), self.error_fh)
