'Write request logs to a file.'

def RequestLogs(self):

    args_length = len(self.args)
    module = ''
    if (args_length == 2):
        appyaml = self._ParseAppInfoFromYaml(self.args.pop(0))
        app_id = appyaml.application
        module = (appyaml.module or '')
        version = appyaml.version
    elif (args_length == 1):
        if (not (self.options.app_id and self.options.version)):
            self.parser.error('Expected    the    --application    and    --version    flags    if    <directory>    argument    is    not    specified.')
    else:
        self._PrintHelpAndExit()
    if self.options.app_id:
        app_id = self.options.app_id
    if self.options.module:
        module = self.options.module
    if self.options.version:
        version = self.options.version
    if ((self.options.severity is not None) and (not (0 <= self.options.severity <= MAX_LOG_LEVEL))):
        self.parser.error(('Severity    range    is    0    (DEBUG)    through    %s    (CRITICAL).' % MAX_LOG_LEVEL))
    if (self.options.num_days is None):
        self.options.num_days = int((not self.options.append))
    try:
        end_date = self._ParseEndDate(self.options.end_date)
    except (TypeError, ValueError):
        self.parser.error('End    date    must    be    in    the    format    YYYY-MM-DD.')
    rpcserver = self._GetRpcServer()
    logs_requester = LogsRequester(rpcserver, app_id, module, version, self.args[0], self.options.num_days, self.options.append, self.options.severity, end_date, self.options.vhost, self.options.include_vhost, self.options.include_all, time_func=self.time_func)
    logs_requester.DownloadLogs()
