Skip to content

Commit a55b0a0

Browse files
Deprecate DebugHandlerPass in favor of AddDebugLogProcessorPass in FrameworkBundle
1 parent 0b42713 commit a55b0a0

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

DependencyInjection/Compiler/DebugHandlerPass.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bundle\MonologBundle\DependencyInjection\Compiler;
1313

14+
@trigger_error('The '.__NAMESPACE__.'\DebugHandlerPass class is deprecated since version 2.12 and will be removed in 3.0. Use AddDebugLogProcessorPass in FrameworkBundle instead.', E_USER_DEPRECATED);
15+
1416
use Symfony\Component\DependencyInjection\Reference;
1517
use Symfony\Component\DependencyInjection\ContainerBuilder;
1618
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
@@ -22,6 +24,8 @@
2224
*
2325
* @author Christophe Coevoet <[email protected]>
2426
* @author Jordi Boggiano <[email protected]>
27+
*
28+
* @deprecated since version 2.12, to be removed in 3.0. Use AddDebugLogProcessorPass in FrameworkBundle instead.
2529
*/
2630
class DebugHandlerPass implements CompilerPassInterface
2731
{

DependencyInjection/MonologExtension.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ public function load(array $configs, ContainerBuilder $container)
103103
'Monolog\\Handler\\TestHandler',
104104
'Monolog\\Logger',
105105
'Symfony\\Bridge\\Monolog\\Logger',
106-
'Symfony\\Bridge\\Monolog\\Handler\\DebugHandler',
107106
'Monolog\\Handler\\FingersCrossed\\ActivationStrategyInterface',
108107
'Monolog\\Handler\\FingersCrossed\\ErrorLevelActivationStrategy',
109108
));

MonologBundle.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ public function build(ContainerBuilder $container)
3434
parent::build($container);
3535

3636
$container->addCompilerPass($channelPass = new LoggerChannelPass());
37-
$container->addCompilerPass(new DebugHandlerPass($channelPass));
37+
if (!class_exists('Symfony\Bridge\Monolog\Processor\DebugProcessor')) {
38+
$container->addCompilerPass(new DebugHandlerPass($channelPass));
39+
}
3840
$container->addCompilerPass(new FixEmptyLoggerPass($channelPass));
3941
$container->addCompilerPass(new AddProcessorsPass());
4042
$container->addCompilerPass(new AddSwiftMailerTransportPass());

Tests/DependencyInjection/Fixtures/yml/parameterized_handlers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ parameters:
44
services:
55
foo_logger:
66
class: Foo
7-
tags: [{ name: monolog.logger, channel: %channel_parameter% }]
7+
tags: [{ name: monolog.logger, channel: '%channel_parameter%' }]
88

99
monolog:
1010
handlers:
1111
custom:
1212
type: stream
1313
path: /tmp/symfony.log
14-
channels: %channel_parameter%
14+
channels: '%channel_parameter%'

0 commit comments

Comments
 (0)