Commit 92747302 authored by Fabien Potencier's avatar Fabien Potencier

removing the monolog.configure to be consistent with other providers like Twig

parent dd002177
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.
......
......@@ -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
------
......
......@@ -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) {
......
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