youYou can do the same thing you did in magento oneMagento 1.x in the method \Magento\Framework\Event\Manager::dispatch()
.
but it's a difference. You don't have access to the logger.
You will have to inject an instance of the logger in the constructor.
$protectedprotected $logger;
public function __construct(
InvokerInterface $invoker,
ConfigInterface $eventConfig,
\Psr\Log\LoggerInterface $logger
)
{
$this->_invoker = $invoker;
$this->_eventConfig = $eventConfig;
$this->logger = $logger;
}
Then you can call in the dispatch
method this:
$this->logger->info($message);
Instead of info
you can use all the methods from \Psr\Log\LoggerInterface