Google\Cloud\Logging\V2\LoggingServiceV2Client::listLogEntries PHP Метод

listLogEntries() публичный Метод

Sample code: try { $loggingServiceV2Client = new LoggingServiceV2Client(); $resourceNames = []; foreach ($loggingServiceV2Client->listLogEntries($resourceNames) as $element) { doThingsWith(element); } } finally { if (isset($loggingServiceV2Client)) { $loggingServiceV2Client->close(); } }
public listLogEntries ( string[] $resourceNames, array $optionalArgs = [] ) : Google\GAX\PagedListResponse
$resourceNames string[] Required. One or more cloud resources from which to retrieve log entries: "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" Projects listed in the `project_ids` field are added to this list.
$optionalArgs array { Optional. @type string[] $projectIds Deprecated. One or more project identifiers or project numbers from which to retrieve log entries. Example: `"my-project-1A"`. If present, these project identifiers are converted to resource format and added to the list of resources in `resourceNames`. Callers should use `resourceNames` rather than this parameter. @type string $filter Optional. A filter that chooses which log entries to return. See [Advanced Logs Filters](/logging/docs/view/advanced_filters). Only log entries that match the filter are returned. An empty filter matches all log entries. The maximum length of the filter is 20000 characters. @type string $orderBy Optional. How the results should be sorted. Presently, the only permitted values are `"timestamp asc"` (default) and `"timestamp desc"`. The first option returns entries in order of increasing values of `LogEntry.timestamp` (oldest first), and the second option returns entries in order of decreasing timestamps (newest first). Entries with equal timestamps are returned in order of `LogEntry.insertId`. @type int $pageSize The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. @type string $pageToken A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. @type \Google\GAX\RetrySettings $retrySettings Retry settings to use for this call. If present, then $timeoutMillis is ignored. @type int $timeoutMillis Timeout to use for this call. Only used if $retrySettings is not set. }
Результат Google\GAX\PagedListResponse
    public function listLogEntries($resourceNames, $optionalArgs = [])
    {
        $request = new ListLogEntriesRequest();
        foreach ($resourceNames as $elem) {
            $request->addResourceNames($elem);
        }
        if (isset($optionalArgs['projectIds'])) {
            foreach ($optionalArgs['projectIds'] as $elem) {
                $request->addProjectIds($elem);
            }
        }
        if (isset($optionalArgs['filter'])) {
            $request->setFilter($optionalArgs['filter']);
        }
        if (isset($optionalArgs['orderBy'])) {
            $request->setOrderBy($optionalArgs['orderBy']);
        }
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }
        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }
        $mergedSettings = $this->defaultCallSettings['listLogEntries']->merge(new CallSettings($optionalArgs));
        $callable = ApiCallable::createApiCall($this->loggingServiceV2Stub, 'ListLogEntries', $mergedSettings, $this->descriptors['listLogEntries']);
        return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
    }