. */ namespace SP\Providers\Log; use DI\Container; use DI\DependencyException; use DI\NotFoundException; use Monolog\Handler\StreamHandler; use SP\Core\Events\Event; use SP\Core\Exceptions\InvalidClassException; use SP\Providers\EventsTrait; use SplSubject; /** * Class FileLogHandler * * @package SP\Providers\Log */ final class FileLogHandler extends LoggerBase { use EventsTrait; /** * Devuelve los eventos que implementa el observador * * @return array */ public function getEvents(): array { return LogInterface::EVENTS; } /** * Devuelve los eventos que implementa el observador en formato cadena * * @return string */ public function getEventsString(): string { return $this->events; } /** * Receive update from subject * * @link http://php.net/manual/en/splobserver.update.php * * @param SplSubject $subject

* The SplSubject notifying the observer of an update. *

* * @return void * @throws InvalidClassException * @since 5.1.0 */ public function update(SplSubject $subject) { $this->updateEvent('update', new Event($subject)); } /** * @param Container $dic * * @throws DependencyException * @throws NotFoundException */ protected function initialize(Container $dic) { parent::initialize($dic); $this->logger->pushHandler(new StreamHandler(LOG_FILE)); } }