Skip to content

Commit 3f29cb2

Browse files
committed
Enforce that channels defined in the config are public loggers
Channels can be created for 2 reasons: - because a service requests to use it through the monolog.logger tag, in which case a private channel is fine (as it is injected using the DIC) - because the bundle config asks to create it. In this case, the channel should be a public service, as the use case is to be able to use this channel through public access (otherwise, the previous way would have been used).
1 parent b558678 commit 3f29cb2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

DependencyInjection/Compiler/LoggerChannelPass.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function process(ContainerBuilder $container)
6868
foreach ($container->getParameter('monolog.additional_channels') as $chan) {
6969
$loggerId = sprintf('monolog.logger.%s', $chan);
7070
$this->createLogger($chan, $loggerId, $container);
71+
$container->getDefinition($loggerId)->setPublic(true);
7172
}
7273
$container->getParameterBag()->remove('monolog.additional_channels');
7374

0 commit comments

Comments
 (0)