Google\Cloud\Logging\LoggingClient::__construct PHP Method

__construct() public method

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. }
    public function __construct(array $config = [])
    {
        $connectionType = $this->getConnectionType($config);
        if (!isset($config['scopes'])) {
            $config['scopes'] = [self::FULL_CONTROL_SCOPE];
        }
        $this->connection = $connectionType === 'grpc' ? new Grpc($this->configureAuthentication($config)) : new Rest($this->configureAuthentication($config));
        $this->formattedProjectName = "projects/{$this->projectId}";
    }