[MonologBundle] Add logger alias to monolog.logger

This commit is contained in:
Jordi Boggiano 2011-04-18 09:27:58 +02:00
parent f4aae27904
commit 4cdd482762
2 changed files with 3 additions and 2 deletions

View File

@ -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);

View File

@ -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>