I want to extend monolog logger in Symfony to add method like:
public function logException(\Exception $e)
{
$this->error($e->getMessage(), ['exception' => $e]);
}
I added new service trying to override logger
logger:
class: ...\AppBundle\Service\MyLogger
or
MyLogger:
class: Namespace\MyLogger
logger:
alias: MyLogger
My code is working but PhpStorm cannot index $this->get('logger')
logException($e) mark "logException" method as undefined.
The logger for PHPStorm still pointing to \Symfony\Bridge\Monolog\Logger
What is the right way to extend monolog.logger.class
and add custom logic?