Browse Source

[MonologBundle] Add logger alias to monolog.logger

Jordi Boggiano 14 years ago
parent
commit
4cdd482762

+ 2 - 2
src/Symfony/Bundle/MonologBundle/DependencyInjection/Compiler/LoggerChannelPass.php

@@ -27,13 +27,13 @@ class LoggerChannelPass implements CompilerPassInterface
 
     public function process(ContainerBuilder $container)
     {
-        if (false === $container->hasDefinition('monolog.logger')) {
+        if (!$container->hasDefinition('monolog.logger')) {
             return;
         }
 
         foreach ($container->findTaggedServiceIds('monolog.logger') as $id => $tags) {
             foreach ($tags as $tag) {
-                if (!empty ($tag['channel']) && 'app' !== $tag['channel']) {
+                if (!empty($tag['channel']) && 'app' !== $tag['channel']) {
                     $definition = $container->getDefinition($id);
                     $loggerId = sprintf('monolog.logger.%s', $tag['channel']);
                     $this->createLogger($tag['channel'], $loggerId, $container);

+ 1 - 0
src/Symfony/Bundle/MonologBundle/Resources/config/monolog.xml

@@ -20,6 +20,7 @@
         <service id="monolog.logger" parent="monolog.logger_prototype">
             <argument index="0">app</argument>
         </service>
+        <service id="logger" alias="monolog.logger" />
         <service id="monolog.logger_prototype" class="%monolog.logger.class%" abstract="true">
             <argument /><!-- Channel -->
         </service>