Example:
Create an entry with a key/value set of data
$entry = $logger->entry(['user' => 'calvin']);
Create an entry with a string
$entry = $logger->entry('my message');
Create an entry with a severity of EMERGENCY and specifying a resource.
$entry = $logger->entry('my message', [
'severity' => Logger::EMERGENCY,
'resource' => [
'type' => 'gcs_bucket',
'labels' => [
'bucket_name' => 'my-bucket'
]
]
]);
public entry ( array | string $data, array $options = [] ) : Entry |
$data |
array | string |
The data to log. When providing a string the
data will be stored as a `textPayload` type. When providing an
array the data will be stored as a `jsonPayload` type. |
$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 this log entry with. **Defaults to** type global.
@type array $httpRequest Information about the HTTP request
associated with this log entry, if applicable. Please see
[the API docs](https://cloud.google.com/logging/docs/api/reference/rest/Shared.Types/LogEntry#httprequest)
for more information.
@type array $labels A set of user-defined (key, value) data that
provides additional information about the log entry.
@type array $operation Additional information about a potentially
long-running operation with which a log entry is associated.
Please see [the API docs](https://cloud.google.com/logging/docs/api/reference/rest/Shared.Types/LogEntry#logentryoperation)
for more information.
@type string|int $severity The severity of the log entry. **Defaults to**
`"DEFAULT"`.
} |
return |
Entry |
|