File tree 2 files changed +23
-0
lines changed
Bundle/FrameworkBundle/DependencyInjection/Compiler
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,21 @@ public function reset()
75
75
$ this ->clear ();
76
76
}
77
77
78
+ public function removeDebugLogger ()
79
+ {
80
+ foreach ($ this ->processors as $ k => $ processor ) {
81
+ if ($ processor instanceof DebugLoggerInterface) {
82
+ unset($ this ->processors [$ k ]);
83
+ }
84
+ }
85
+
86
+ foreach ($ this ->handlers as $ k => $ handler ) {
87
+ if ($ handler instanceof DebugLoggerInterface) {
88
+ unset($ this ->handlers [$ k ]);
89
+ }
90
+ }
91
+ }
92
+
78
93
/**
79
94
* Returns a DebugLoggerInterface instance if one is registered with this logger.
80
95
*
Original file line number Diff line number Diff line change @@ -30,6 +30,14 @@ public function process(ContainerBuilder $container)
30
30
}
31
31
32
32
$ definition = $ container ->getDefinition ('monolog.logger_prototype ' );
33
+ $ definition ->setConfigurator ([__CLASS__ , 'configureLogger ' ]);
33
34
$ definition ->addMethodCall ('pushProcessor ' , [new Reference ('debug.log_processor ' )]);
34
35
}
36
+
37
+ public static function configureLogger ($ logger )
38
+ {
39
+ if (method_exists ($ logger , 'removeDebugLogger ' ) && 'cli ' === \PHP_SAPI ) {
40
+ $ logger ->removeDebugLogger ();
41
+ }
42
+ }
35
43
}
You can’t perform that action at this time.
0 commit comments