Logging/src/LoggingClient.php
public function psrLogger($name, array $options = [])
    {
        $messageKey = null;

        if (isset($options['messageKey'])) {
            $messageKey = $options['messageKey'];
            unset($options['messageKey']);
        }

        $psrLoggerOptions = $this->pluckArray([
            'metadataProvider',
            'batchEnabled',
            'debugOutput',
            'batchOptions',
            'clientConfig',
            'batchRunner',
            'closureSerializer',
            'debugOutputResource'
        ], $options);

        return new PsrLogger(
            $this->logger($name, $options),
            $messageKey,
            $psrLoggerOptions + [
                'clientConfig' => $this->config
            ]
        );
    }
public function psrLogger($name, array $options = [])
    {
        $messageKey = null;

        if (isset($options['messageKey'])) {
            $messageKey = $options['messageKey'];
            unset($options['messageKey']);
        }

        $psrLoggerOptions = $this->pluckArray([
            'metadataProvider',
            'batchEnabled',
            'debugOutput',
            'batchOptions',
            'clientConfig',
            'batchRunner',
            'closureSerializer',
            'debugOutputResource'
        ], $options);

        return new PsrLogger(
            $this->logger($name, $options),
            $messageKey,
            $psrLoggerOptions + [
                'clientConfig' => $this->config
            ]
        );
    }
public function psrLogger ( $ name , array $ options = [ ] ) { $ messageKey = null ; if ( isset ( $ options [ 'messageKey' ] ) ) { $ messageKey = $ options [ 'messageKey' ] ; unset ( $ options [ 'messageKey' ] ) ; } $ psrLoggerOptions = $ this -> pluckArray ( [ 'metadataProvider' , 'batchEnabled' , 'debugOutput' , 'batchOptions' , 'clientConfig' , 'batchRunner' , 'closureSerializer' , 'debugOutputResource' ] , $ options ) ; return new PsrLogger ( $ this -> logger ( $ name , $ options ) , $ messageKey , $ psrLoggerOptions + [ 'clientConfig' => $ this -> config ] ) ; }
Fetches a logger which will write log entries to Stackdriver Logging and
implements the PSR-3 specification.

Example:
```
$psrLogger = $logging->psrLogger('my-log');
```

```
// Write entries with background batching.
$psrLogger = $logging->psrLogger('my-log', [
'batchEnabled' => true
]);
```

@param string $name The name of the log to write entries to.
@param array $options [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/v2/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.
@type MetadataProviderInterface $metadataProvider **Defaults to** An
automatically chosen provider, based on detected environment
settings.
@type bool $batchEnabled Determines whether or not to use background
batching. **Defaults to** `false`.
@type bool $debugOutput Whether or not to output debug information.
Please note debug output currently only applies in CLI based
applications. **Defaults to** `false`. Applies only when
`batchEnabled` is set to `true`.
@type resource $debugOutputResource A resource to output debug output
to. Applies only when `batchEnabled` is set to `true`.
@type array $batchOptions A set of options for a BatchJob.
{@see \Google\Cloud\Core\Batch\BatchJob::__construct()} for
more details.
**Defaults to** ['batchSize' => 1000,
'callPeriod' => 2.0,
'numWorkers' => 2]. Applies only when
`batchEnabled` is set to `true`. Note that this option is
currently considered **experimental** and is subject to change.
@type array $clientConfig Configuration options for the Logging client
used to handle processing of batch items. For valid options
please see
{@see \Google\Cloud\Logging\LoggingClient::__construct()}.
**Defaults to** the options provided to the current client.
Applies only when `batchEnabled` is set to `true`.
@type BatchRunner $batchRunner A BatchRunner object. Mainly used for
the tests to inject a mock. **Defaults to** a newly created
BatchRunner. Applies only when `batchEnabled` is set to `true`.
@type ClosureSerializerInterface $closureSerializer An implementation
responsible for serializing closures used in the
`$clientConfig`. This is especially important when using the
batch daemon. **Defaults to**
{@see Google\Cloud\Core\Batch\OpisClosureSerializer} if the
`opis/closure` library is installed.
}
@return PsrLogger
Fetches a logger which will write log entries to Stackdriver Logging and implements the PSR - 3 specification .