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
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$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