Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59d8bb4

Browse files
committed
Add param for setting log levels in DI
1 parent c5bf415 commit 59d8bb4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
<tag name="monolog.logger" channel="request" />
129129
<argument>%twig.exception_listener.controller%</argument>
130130
<argument type="service" id="logger" on-invalid="null" />
131+
<argument>%twig.exception_listener.http_log_levels%</argument>
131132
</service>
132133

133134
<service id="twig.controller.exception" class="Symfony\Bundle\TwigBundle\Controller\ExceptionController" public="true">

src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ class ExceptionListener implements EventSubscriberInterface
3333
protected $logger;
3434
protected $httpStatusCodeLogLevel = array();
3535

36-
public function __construct($controller, LoggerInterface $logger = null)
36+
public function __construct($controller, LoggerInterface $logger = null, $httpStatusCodeLogLevel = array())
3737
{
3838
$this->controller = $controller;
3939
$this->logger = $logger;
40+
if (is_array($this->httpStatusCodeLogLevel) && count($this->httpStatusCodeLogLevel)) {
41+
$this->httpStatusCodeLogLevel = $httpStatusCodeLogLevel;
42+
}
4043
}
4144

4245
public function logKernelException(GetResponseForExceptionEvent $event)

0 commit comments

Comments
 (0)