. */ namespace SP\Providers\Log; 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): void { $this->update('update', new Event($subject)); } public function initialize(): void { $this->logger->pushHandler(new StreamHandler(LOG_FILE)); parent::initialize(); } }