Skip to content

Commit

Permalink
Add param for setting log levels in DI
Browse files Browse the repository at this point in the history
  • Loading branch information
mtibben committed Dec 19, 2017
1 parent c5bf415 commit 59d8bb4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
Expand Up @@ -128,6 +128,7 @@
<tag name="monolog.logger" channel="request" />
<argument>%twig.exception_listener.controller%</argument>
<argument type="service" id="logger" on-invalid="null" />
<argument>%twig.exception_listener.http_log_levels%</argument>
</service>

<service id="twig.controller.exception" class="Symfony\Bundle\TwigBundle\Controller\ExceptionController" public="true">
Expand Down
Expand Up @@ -33,10 +33,13 @@ class ExceptionListener implements EventSubscriberInterface
protected $logger;
protected $httpStatusCodeLogLevel = array();

public function __construct($controller, LoggerInterface $logger = null)
public function __construct($controller, LoggerInterface $logger = null, $httpStatusCodeLogLevel = array())
{
$this->controller = $controller;
$this->logger = $logger;
if (is_array($this->httpStatusCodeLogLevel) && count($this->httpStatusCodeLogLevel)) {
$this->httpStatusCodeLogLevel = $httpStatusCodeLogLevel;
}
}

public function logKernelException(GetResponseForExceptionEvent $event)
Expand Down

0 comments on commit 59d8bb4

Please sign in to comment.