Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
5b46a783
Commit
5b46a783
authored
May 26, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the possibility to register a logger for internal services
parent
7a376eb3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
doc/services.rst
doc/services.rst
+4
-0
src/Silex/Application.php
src/Silex/Application.php
+4
-2
No files found.
doc/services.rst
View file @
5b46a783
...
@@ -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.
...
...
src/Silex/Application.php
View file @
5b46a783
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment