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

write() public method

Example: Writing a simple log entry. $logger->write('a log entry'); Writing a simple entry with a key/value set of data and a severity of EMERGENCY. $logger->write(['user' => 'calvin'], [ 'severity' => Logger::EMERGENCY ]); Using the entry factory method to write a log entry. $entry = $logger->entry('a log entry'); $logger->write($entry);
See also: https://cloud.google.com/logging/docs/api/reference/rest/v2/entries/write Entries write API documentation.
public write ( array | string | Entry $entry, array $options = [] )
$entry array | string | Entry The entry to write to the log.
$options array [optional] Please see {@see \Google\Cloud\Logging\Logger::entry()} to see the options that can be applied to a log entry. Please note that if the provided entry is of type `Entry` these options will overwrite those that may already be set on the instance.
    public function write($entry, array $options = [])
    {
        $entryOptions = $this->pluckArray($this->entryOptions, $options);
        if ($entry instanceof Entry) {
            if ($entryOptions) {
                $entry = new Entry($entryOptions + $entry->info());
            }
        } else {
            $entry = $this->entry($entry, $entryOptions);
        }
        $this->writeBatch([$entry], $options);
    }