lithium\analysis\logger\adapter\Growl::notify()

public method

Posts a new notification to the Growl server.

Parameters

  • string $description

    Message to be displayed.

  • array $options

    Options consists of: -'title': The title of the displayed notification. Displays the name of the application's parent folder by default.

Returns

boolean

Always returns true.

Source

	public function notify($description = '', $options = []) {
		$this->_register();

		$defaults = ['sticky' => false, 'priority' => 0, 'type' => 'Messages'];
		$options += $defaults + ['title' => $this->_config['title']];
		$type = $options['type'];
		$title = $options['title'];

		$message = compact('type', 'title', 'description') + ['app' => $this->_config['name']];
		$message = array_map('utf8_encode', $message);

		$flags = ($options['priority'] & 7) * 2;
		$flags = ($options['priority'] < 0) ? $flags |= 8 : $flags;
		$flags = ($options['sticky']) ? $flags | 256 : $flags;

		$params = ['c2n5', static::PROTOCOL_VERSION, static::TYPE_NOTIFY, $flags];
		$lengths = array_map('strlen', $message);

		$data = call_user_func_array('pack', array_merge($params, $lengths));
		$data .= join('', $message);
		$data .= pack('H32', md5($data . $this->_config['password']));

		$this->_send($data);
		return true;
	}