Permalink
Browse files

Injecting the Service Locator as a 2nd argument of the logger callable.

  • Loading branch information...
1 parent c23204f commit f7e23db70733943e450cba1799f33bc8bd329abe @jhuet jhuet committed Nov 24, 2012
@@ -31,7 +31,8 @@ return array(
//
// 'filters' => array() // array('filterName' => 'BSON\Filter\Class'),
//
-// 'logger_callable' => null
+// 'logger_callable' => function (array $log, \Zend\ServiceManager\ServiceLocatorInterface $sl) {
+// })
)
),
@@ -46,8 +46,10 @@ public function createService(ServiceLocatorInterface $serviceLocator)
$config = new Configuration;
- // the logger
- $config->setLoggerCallable($options->getLoggerCallable());
+ // the logger with an injection of the service locator as a 2nd argument
+ $config->setLoggerCallable(function(array $log) use ($options, $serviceLocator) {
+ call_user_func_array($options->getLoggerCallable(), array($log, $serviceLocator));
+ });
// proxies
$config->setAutoGenerateProxyClasses($options->getGenerateProxies());

0 comments on commit f7e23db

Please sign in to comment.