Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 78f4f88

Browse filesBrowse files
committed
[FrameworkBundle] Allow to pass a logger instance to the Router
1 parent 12f6db8 commit 78f4f88
Copy full SHA for 78f4f88

File tree

3 files changed

+15
-5
lines changed
Filter options

3 files changed

+15
-5
lines changed

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.1.0
5+
-----
6+
7+
* allowed to pass an optional `LoggerInterface $logger` instance to the `Router`
8+
49
4.0.0
510
-----
611

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
</service>
5252

5353
<service id="router.default" class="Symfony\Bundle\FrameworkBundle\Routing\Router">
54+
<tag name="monolog.logger" channel="router" />
5455
<argument type="service" id="service_container" />
5556
<argument>%router.resource%</argument>
5657
<argument type="collection">
@@ -66,6 +67,7 @@
6667
<argument key="matcher_cache_class">%router.cache_class_prefix%UrlMatcher</argument>
6768
</argument>
6869
<argument type="service" id="router.request_context" on-invalid="ignore" />
70+
<argument type="service" id="logger" on-invalid="ignore" />
6971
<call method="setConfigCacheFactory">
7072
<argument type="service" id="config_cache_factory" />
7173
</call>

‎src/Symfony/Bundle/FrameworkBundle/Routing/Router.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Routing;
1313

14+
use Psr\Log\LoggerInterface;
1415
use Symfony\Component\Config\Loader\LoaderInterface;
1516
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
1617
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
@@ -33,17 +34,19 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
3334
private $collectedParameters = array();
3435

3536
/**
36-
* @param ContainerInterface $container A ContainerInterface instance
37-
* @param mixed $resource The main resource to load
38-
* @param array $options An array of options
39-
* @param RequestContext $context The context
37+
* @param ContainerInterface $container A ContainerInterface instance
38+
* @param mixed $resource The main resource to load
39+
* @param array $options An array of options
40+
* @param RequestContext $context The context
41+
* @param LoggerInterface|null $logger
4042
*/
41-
public function __construct(ContainerInterface $container, $resource, array $options = array(), RequestContext $context = null)
43+
public function __construct(ContainerInterface $container, $resource, array $options = array(), RequestContext $context = null, LoggerInterface $logger = null)
4244
{
4345
$this->container = $container;
4446

4547
$this->resource = $resource;
4648
$this->context = $context ?: new RequestContext();
49+
$this->logger = $logger;
4750
$this->setOptions($options);
4851
}
4952

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.