@@ -34,27 +34,29 @@ public function process(ContainerBuilder $container)
3434
3535 foreach ($ container ->findTaggedServiceIds ('monolog.logger ' ) as $ id => $ tags ) {
3636 foreach ($ tags as $ tag ) {
37- if (!empty ($ tag ['channel ' ]) && 'app ' !== $ tag ['channel ' ]) {
38- $ definition = $ container ->getDefinition ($ id );
39- $ loggerId = sprintf ('monolog.logger.%s ' , $ tag ['channel ' ]);
40- $ this ->createLogger ($ tag ['channel ' ], $ loggerId , $ container );
37+ if (empty ($ tag ['channel ' ]) || 'app ' === $ tag ['channel ' ]) {
38+ continue ;
39+ }
4140
42- foreach ($ definition ->getArguments () as $ index => $ argument ) {
43- if ($ argument instanceof Reference && 'logger ' === (string ) $ argument ) {
44- $ definition ->replaceArgument ($ index , new Reference ($ loggerId , $ argument ->getInvalidBehavior (), $ argument ->isStrict ()));
45- }
41+ $ definition = $ container ->getDefinition ($ id );
42+ $ loggerId = sprintf ('monolog.logger.%s ' , $ tag ['channel ' ]);
43+ $ this ->createLogger ($ tag ['channel ' ], $ loggerId , $ container );
44+
45+ foreach ($ definition ->getArguments () as $ index => $ argument ) {
46+ if ($ argument instanceof Reference && 'logger ' === (string ) $ argument ) {
47+ $ definition ->replaceArgument ($ index , new Reference ($ loggerId , $ argument ->getInvalidBehavior (), $ argument ->isStrict ()));
4648 }
49+ }
4750
48- $ calls = $ definition ->getMethodCalls ();
49- foreach ($ calls as $ i => $ call ) {
50- foreach ($ call [1 ] as $ index => $ argument ) {
51- if ($ argument instanceof Reference && 'logger ' === (string ) $ argument ) {
52- $ calls [$ i ][1 ][$ index ] = new Reference ($ loggerId , $ argument ->getInvalidBehavior (), $ argument ->isStrict ());
53- }
51+ $ calls = $ definition ->getMethodCalls ();
52+ foreach ($ calls as $ i => $ call ) {
53+ foreach ($ call [1 ] as $ index => $ argument ) {
54+ if ($ argument instanceof Reference && 'logger ' === (string ) $ argument ) {
55+ $ calls [$ i ][1 ][$ index ] = new Reference ($ loggerId , $ argument ->getInvalidBehavior (), $ argument ->isStrict ());
5456 }
5557 }
56- $ definition ->setMethodCalls ($ calls );
5758 }
59+ $ definition ->setMethodCalls ($ calls );
5860 }
5961 }
6062
0 commit comments