Commit 5b46a783 authored by Fabien Potencier's avatar Fabien Potencier

added the possibility to register a logger for internal services

parent 7a376eb3
...@@ -215,6 +215,10 @@ don't want to mess with most of them. ...@@ -215,6 +215,10 @@ don't want to mess with most of them.
does not return a Response. Disable it with does not return a Response. Disable it with
`unset($app['exception_handler'])`. `unset($app['exception_handler'])`.
* **logger**: A
`http://api.symfony.com/master/Symfony/Component/HttpKernel/Log/LoggerInterface.html`_
instance. By default, logging is disabled as the value is set to `null`.
.. note:: .. note::
All of these Silex core services are shared. All of these Silex core services are shared.
......
...@@ -55,6 +55,8 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe ...@@ -55,6 +55,8 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
{ {
$app = $this; $app = $this;
$this['logger'] = null;
$this['routes'] = $this->share(function () { $this['routes'] = $this->share(function () {
return new RouteCollection(); return new RouteCollection();
}); });
...@@ -74,13 +76,13 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe ...@@ -74,13 +76,13 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
$urlMatcher = new LazyUrlMatcher(function () use ($app) { $urlMatcher = new LazyUrlMatcher(function () use ($app) {
return $app['url_matcher']; return $app['url_matcher'];
}); });
$dispatcher->addSubscriber(new RouterListener($urlMatcher)); $dispatcher->addSubscriber(new RouterListener($urlMatcher, $app['logger']));
return $dispatcher; return $dispatcher;
}); });
$this['resolver'] = $this->share(function () use ($app) { $this['resolver'] = $this->share(function () use ($app) {
return new ControllerResolver($app); return new ControllerResolver($app, $app['logger']);
}); });
$this['kernel'] = $this->share(function () use ($app) { $this['kernel'] = $this->share(function () use ($app) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment