PHP 클래스 Google\Cloud\Logging\LoggingClient

Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder(); $logging = $cloud->logging(); LoggingClient can be instantiated directly. use Google\Cloud\Logging\LoggingClient; $logging = new LoggingClient();
상속: use trait Google\Cloud\ClientTrait
파일 보기 프로젝트 열기: GoogleCloudPlatform/gcloud-php

보호된 프로퍼티들

프로퍼티 타입 설명
$connection Represents a connection to Stackdriver Logging.

공개 메소드들

메소드 설명
__construct ( array $config = [] ) Create a Logging client.
createMetric ( string $name, string $filter, array $options = [] ) : Metric Create a metric.
createSink ( string $name, string $destination, array $options = [] ) : Sink Create a sink.
entries ( array $options = [] ) : Generator Fetches log entries.
logger ( string $name, array $options = [] ) : Logger Fetches a logger which will write log entries to Stackdriver Logging.
metric ( string $name ) : Metric Lazily instantiates a metric. There are no network requests made at this point. To see the operations that can be performed on a metric please see {@see Google\Cloud\Logging\Metric}.
metrics ( array $options = [] ) : Generator Fetches metrics associated with your project.
psrLogger ( string $name, array $options = [] ) : PsrLogger Fetches a logger which will write log entries to Stackdriver Logging and implements the PSR-3 specification.
sink ( string $name ) : Sink Lazily instantiates a sink. There are no network requests made at this point. To see the operations that can be performed on a sink please see {@see Google\Cloud\Logging\Sink}.
sinks ( array $options = [] ) : Generator Fetches sinks associated with your project.

메소드 상세

__construct() 공개 메소드

Create a Logging client.
public __construct ( array $config = [] )
$config array [optional] { Configuration options. @type string $projectId The project ID from the Google Developer's Console. @type CacheItemPoolInterface $authCache A cache for storing access tokens. **Defaults to** a simple in memory implementation. @type array $authCacheOptions Cache configuration options. @type callable $authHttpHandler A handler used to deliver Psr7 requests specifically for authentication. @type callable $httpHandler A handler used to deliver Psr7 requests. Only valid for requests sent over REST. @type string $keyFile The contents of the service account credentials .json file retrieved from the Google Developers Console. @type string $keyFilePath The full path to your service account credentials .json file retrieved from the Google Developers Console. @type int $retries Number of retries for a failed request. **Defaults to** `3`. @type array $scopes Scopes to be used for the request. @type string $transport The transport type used for requests. May be either `grpc` or `rest`. **Defaults to** `grpc` if gRPC support is detected on the system. }

createMetric() 공개 메소드

Example: $metric = $logging->createMetric( 'my-metric', 'logName = projects/my-project/logs/my-log' );
또한 보기: https://cloud.google.com/logging/docs/api/reference/rest/v2/projects.metrics/create projects.metrics create API documentation.
public createMetric ( string $name, string $filter, array $options = [] ) : Metric
$name string The name of the metric.
$filter string An [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters).
$options array [optional] { Configuration Options. @type string $description A description of the metric. }
리턴 Metric

createSink() 공개 메소드

Example: $sink = $logging->createSink('my-sink', 'storage.googleapis.com/my-bucket');
또한 보기: https://cloud.google.com/logging/docs/api/reference/rest/v2/projects.sinks/create projects.sinks create API documentation.
public createSink ( string $name, string $destination, array $options = [] ) : Sink
$name string The name of the sink.
$destination string The export destination. Please see [Exporting Logs With Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs#about_sinks) for more information and examples.
$options array [optional] { Configuration options. @type string $filter An [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters). @type string $outputVersionFormat The log entry version to use for this sink's exported log entries. This version does not have to correspond to the version of the log entry when it was written to Stackdriver Logging. May be either `V1` or `V2`. **Defaults to** `V2`. }
리턴 Sink

entries() 공개 메소드

Example: $entries = $logging->entries(); foreach ($entries as $entry) { echo $entry->info()['textPayload'] . PHP_EOL; } Use an advanced logs filter to fetch only entries from a specified log. $entries = $logging->entries([ 'filter' => 'logName = projects/my-project/logs/my-log' ]); foreach ($entries as $entry) { echo $entry->info()['textPayload'] . PHP_EOL; }
또한 보기: https://cloud.google.com/logging/docs/api/reference/rest/v2/entries/list Entries list API documentation.
public entries ( array $options = [] ) : Generator
$options array [optional] { Configuration options. @type string[] $projectIds A list of projectIds to fetch entries from in addition to entries found in the project bound to this client. @type string[] $resourceNames One or more cloud resources from which to retrieve log entries. Projects listed in projectIds are added to this list. Example: "projects/my-project-1A", "projects/1234567890". @type string $filter An [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters). @type string $orderBy How the results should be sorted. Presently, the only permitted values are `timestamp asc` and `timestamp desc`. **Defaults to** `"timestamp asc"`. @type int $pageSize The maximum number of results to return per request. }
리턴 Generator

logger() 공개 메소드

Example: $logger = $logging->logger('my-log');
public logger ( string $name, array $options = [] ) : Logger
$name string The name of the log to write entries to.
$options array [optional] { Configuration options. @type array $resource The [monitored resource](https://cloud.google.com/logging/docs/api/reference/rest/Shared.Types/MonitoredResource) to associate log entries with. **Defaults to** type global. @type array $labels A set of user-defined (key, value) data that provides additional information about the log entry. }
리턴 Logger

metric() 공개 메소드

Example: $metric = $logging->metric('my-metric'); echo $metric->name();
public metric ( string $name ) : Metric
$name string The name of the metric.
리턴 Metric

metrics() 공개 메소드

Example: $metrics = $logging->metrics(); foreach ($metrics as $metric) { echo $metric->name() . PHP_EOL; }
또한 보기: https://cloud.google.com/logging/docs/api/reference/rest/v2/projects.metrics/list projects.metrics list API documentation.
public metrics ( array $options = [] ) : Generator
$options array [optional] { Configuration options. @type int $pageSize The maximum number of results to return per request. }
리턴 Generator

psrLogger() 공개 메소드

Example: $psrLogger = $logging->psrLogger('my-log');
public psrLogger ( string $name, array $options = [] ) : PsrLogger
$name string The name of the log to write entries to.
$options array [optional] { Configuration options. @type string $messageKey The key in the `jsonPayload` used to contain the logged message. **Defaults to** `message`. @type array $resource The [monitored resource](https://cloud.google.com/logging/docs/api/reference/rest/Shared.Types/MonitoredResource) to associate log entries with. **Defaults to** type global. @type array $labels A set of user-defined (key, value) data that provides additional information about the log entry. }
리턴 PsrLogger

sink() 공개 메소드

Example: $sink = $logging->sink('my-sink'); echo $sink->name();
public sink ( string $name ) : Sink
$name string The name of the sink.
리턴 Sink

sinks() 공개 메소드

Example: $sinks = $logging->sinks(); foreach ($sinks as $sink) { echo $sink->name() . PHP_EOL; }
또한 보기: https://cloud.google.com/logging/docs/api/reference/rest/v2/projects.sinks/list projects.sinks list API documentation.
public sinks ( array $options = [] ) : Generator
$options array [optional] { Configuration options. @type int $pageSize The maximum number of results to return per request. }
리턴 Generator

프로퍼티 상세

$connection 보호되어 있는 프로퍼티

Represents a connection to Stackdriver Logging.
protected $connection