def GetLogs(self, service, version, severity, vhost, include_vhost,
                include_all, num_days, end_date, output_file):
        """Get application logs for the given version of the service.

    Args:
      service: str, The service of the app to fetch logs from.
      version: str, The version of the app to fetch logs for.
      severity: int, App log severity to request (0-4); None for request logs
        only.
      vhost: str, The virtual host of log messages to get. None for all hosts.
      include_vhost: bool, If true, the virtual host is included in log
        messages.
      include_all: bool, If true, we add to the log message everything we know
        about the request.
      num_days: int, Number of days worth of logs to export; 0 for all
        available.
      end_date: datetime.date, Date object representing last day of logs to
        return.  If None, today is used.
      output_file: Output file name or '-' for standard output.
    """
        rpcserver = self._GetRpcServer()
        requestor = logs_requestor.LogsRequester(rpcserver, self.project,
                                                 service, version, severity,
                                                 vhost, include_vhost,
                                                 include_all)
        requestor.DownloadLogs(num_days, end_date, output_file)
Ejemplo n.º 2
0
    def GetLogsAppend(self, module, version, severity, vhost, include_vhost,
                      include_all, end_date, output_file):
        """Get application logs and append them to an existing file.

    Args:
      module: str, The module of the app to fetch logs from.
      version: str, The version of the app to fetch logs for.
      severity: int, App log severity to request (0-4); None for request logs
        only.
      vhost: str, The virtual host of log messages to get. None for all hosts.
      include_vhost: bool, If true, the virtual host is included in log
        messages.
      include_all: bool, If true, we add to the log message everything we know
        about the request.
      end_date: datetime.date, Date object representing last day of logs to
        return.  If None, today is used.
      output_file: Output file name or '-' for standard output.
    """
        rpcserver = self._GetRpcServer()
        requestor = logs_requestor.LogsRequester(rpcserver, self.project,
                                                 module, version, severity,
                                                 vhost, include_vhost,
                                                 include_all)
        requestor.DownloadLogsAppend(end_date, output_file)