/** * Register a new callback handler for when * a log event is triggered. * * @param Closure $callback * @return void * * @throws \RuntimeException */ public function listen(Closure $callback) { if (!isset($this->dispatcher)) { throw new \RuntimeException("Events dispatcher has not been set."); } $this->dispatcher->listen('illuminate.log', $callback); }
/** * Listen for an event on the extension. * * @param string $name * @param \Closure $callback * @return void */ protected static function registerEvent($name, Closure $callback) { if (!isset(static::$dispatcher)) { return; } static::$dispatcher->listen("extension.{$name}", $callback); }