[MonologBundle] Add logger alias to monolog.logger
This commit is contained in:
parent
f4aae27904
commit
4cdd482762
@ -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);
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user