<?php
namespace App\EventListener;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
class InitEventSubscriber implements EventSubscriberInterface
{
/**
* @var LoggerInterface
*/
private $logger;
/**
* @param LoggerInterface $logger
*/
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
public static function getSubscribedEvents(): array
{
return [
RequestEvent::class => 'onKernelRequest'
];
}
public function onKernelRequest(RequestEvent $event)
{
//
// $request = $event->getRequest();
// $userAgent = $request->headers->get('User-Agent');
//
// $this->logger->info(sprintf('Registrando inicio desde "%s"', $userAgent));
}
}