Writes a message to one or more log adapters, where the adapters that are written to are the ones that respond to the given priority level.

Parameters

  • string $priority The priority of the log message to be written.
  • string $message The message to be written.
  • array $options An array of adapter-specific options that may be passed when writing log messages. Some options are also handled by `Logger` itself: - `'name'` _string_: This option can be specified if you wish to write to a specific adapter configuration, instead of writing to the adapter(s) that respond to the given priority.

Returns

boolean Returns `true` if all log writes succeeded, or `false` if _any or all_ writes failed.
This method can be filtered.

Source

						public static function write($priority, $message, array $options = array()) {
		$defaults = array('name' => null);
		$options += $defaults;
		$result = true;

		if ($name = $options['name']) {
			$methods = array($name => static::adapter($name)->write($priority, $message, $options));
		} elseif (!isset(static::$_priorities[$priority])) {
			$message = "Attempted to write log message with invalid priority `{$priority}`.";
			throw new UnexpectedValueException($message);
		} else {
			$methods = static::_configsByPriority($priority, $message, $options);
		}

		foreach ($methods as $name => $method) {
			$params = compact('priority', 'message', 'options');
			$config = static::_config($name);
			$result &= static::_filter(__FUNCTION__, $params, $method, $config['filters']);
		}
		return $methods ? $result : false;
	}