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

__construct() public method

public __construct ( Google\Cloud\Logging\Connection\ConnectionInterface $connection, string $name, string $projectId, array $resource = null, array $labels = null )
$connection Google\Cloud\Logging\Connection\ConnectionInterface Represents a connection to Stackdriver Logging.
$name string The name of the log to write entries to.
$projectId string The project's ID.
$resource array [optional] The [monitored resource](https://cloud.google.com/logging/docs/api/reference/rest/Shared.Types/MonitoredResource) to associate log entries with. **Defaults to** type global.
$labels array [optional] A set of user-defined (key, value) data that provides additional information about the log entries.
    public function __construct(ConnectionInterface $connection, $name, $projectId, array $resource = null, array $labels = null)
    {
        $this->connection = $connection;
        $this->formattedName = "projects/{$projectId}/logs/{$name}";
        $this->projectId = $projectId;
        $this->resource = $resource ?: ['type' => 'global'];
        $this->labels = $labels;
    }