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
92747302
Commit
92747302
authored
Jul 15, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removing the monolog.configure to be consistent with other providers like Twig
parent
dd002177
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
9 deletions
+32
-9
doc/changelog.rst
doc/changelog.rst
+18
-0
doc/providers/monolog.rst
doc/providers/monolog.rst
+12
-3
src/Silex/Provider/MonologServiceProvider.php
src/Silex/Provider/MonologServiceProvider.php
+2
-6
No files found.
doc/changelog.rst
View file @
92747302
Changelog
=========
* **2012-07-15**: removed the ``monolog.configure`` service. Use the
``extend`` method instead:
Before::
$app['monolog.configure'] = $app->protect(function ($monolog) use ($app) {
// do something
});
After::
$app['monolog'] = $app->share($app->extend('monolog', function($monolog, $app) {
// do something
return $monolog;
}));
* **2012-06-17**: ``ControllerCollection`` now takes a required route instance
as a constructor argument.
...
...
doc/providers/monolog.rst
View file @
92747302
...
...
@@ -31,9 +31,6 @@ Services
$app['monolog']->addDebug('Testing the Monolog logging.');
* **monolog.configure**: Protected closure that takes the logger as an
argument. You can override it if you do not want the default behavior.
Registering
-----------
...
...
@@ -72,6 +69,18 @@ add log entries for any logging level through ``addDebug()``, ``addInfo()``,
return new Response('', 201);
});
Customization
-------------
You can configure Monolog (like adding or changing the handlers) before using
it by extending the ``monolog`` service::
$app['monolog'] = $app->share($app->extend('monolog', function($monolog, $app) {
$monolog->pushHandler(...);
return $monolog;
}));
Traits
------
...
...
src/Silex/Provider/MonologServiceProvider.php
View file @
92747302
...
...
@@ -43,17 +43,13 @@ class MonologServiceProvider implements ServiceProviderInterface
$app
[
'monolog'
]
=
$app
->
share
(
function
(
$app
)
{
$log
=
new
$app
[
'monolog.logger.class'
](
$app
[
'monolog.name'
]);
$app
[
'monolog.configure'
](
$log
);
return
$log
;
});
$app
[
'monolog.configure'
]
=
$app
->
protect
(
function
(
$log
)
use
(
$app
)
{
$log
->
pushHandler
(
$app
[
'monolog.handler'
]);
if
(
$app
[
'debug'
]
&&
isset
(
$app
[
'monolog.handler.debug'
]))
{
$log
->
pushHandler
(
$app
[
'monolog.handler.debug'
]);
}
return
$log
;
});
$app
[
'monolog.handler'
]
=
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