Skip to content

Commit 888b54b

Browse files
committed
minor #389 Remove invalid handlers (jderusse)
This PR was merged into the 3.x-dev branch. Discussion ---------- Remove invalid handlers This PR removes the invalid handlers added in #321: Adding an handler is not only about adding the mapping `shortName` <=> `class`: The constructor's arguments have to be defined in the `buildHandler` function. Otherwise, we get the following exception: ``` InvalidArgumentException: Invalid handler type "logmatic" given for handler "logmatic" /data/oss/monolog-bundle/DependencyInjection/MonologExtension.php:911 ``` This PR adds support for handler "noop". Re-adding supports for the other (more complex) handlers could be done in dedicated PR. Commits ------- 44799b3 Remove invalid handlers
2 parents 8174b8a + 44799b3 commit 888b54b

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

DependencyInjection/MonologExtension.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -992,13 +992,7 @@ private function getHandlerClassByType($handlerType)
992992
$v2HandlerTypesAdded = [
993993
'elasticsearch' => 'Monolog\Handler\ElasticaHandler',
994994
'fallbackgroup' => 'Monolog\Handler\FallbackGroupHandler',
995-
'logmatic' => 'Monolog\Handler\LogmaticHandler',
996995
'noop' => 'Monolog\Handler\NoopHandler',
997-
'overflow' => 'Monolog\Handler\OverflowHandler',
998-
'process' => 'Monolog\Handler\ProcessHandler',
999-
'sendgrid' => 'Monolog\Handler\SendGridHandler',
1000-
'sqs' => 'Monolog\Handler\SqsHandler',
1001-
'telegram' => 'Monolog\Handler\TelegramBotHandler',
1002996
];
1003997

1004998
$v2HandlerTypesRemoved = [

Tests/DependencyInjection/FixtureMonologExtensionTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@ public function testPsr3MessageProcessingDisabledOnNullHandler()
259259
$this->assertNotContainsEquals(['pushProcessor', [new Reference('monolog.processor.psr_log_message')]], $methodCalls, 'The PSR-3 processor should not be enabled');
260260
}
261261

262+
public function testHandlersV2()
263+
{
264+
if (\Monolog\Logger::API < 2) {
265+
$this->markTestSkipped('This test requires Monolog v2');
266+
}
267+
$this->getContainer('handlers');
268+
269+
$this->expectNotToPerformAssertions();
270+
}
271+
262272
public function testPsr3MessageProcessingDisabled()
263273
{
264274
$container = $this->getContainer('process_psr_3_messages_disabled');
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:monolog="http://symfony.com/schema/dic/monolog"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/monolog http://symfony.com/schema/dic/monolog/monolog-1.0.xsd">
8+
9+
<monolog:config>
10+
<monolog:handler name="noop" type="noop"/>
11+
</monolog:config>
12+
</container>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
monolog:
2+
handlers:
3+
noop:
4+
type: noop

0 commit comments

Comments
 (0)