private $logger;
public function __construct(\Psr\Log\LoggerInterface $logger)
{
$this->logger = $logger;
}
And then in your catch
statement:
public function doSomething()
{
try {
/* Some logic that could throw an Exception */
} catch (\Exception $e) {
$this->logger->critical($e->getMessage());
}
}