2
0
Эх сурвалжийг харах

Remove support for legacy Gelf lib

Jordi Boggiano 9 жил өмнө
parent
commit
e46fecde34

+ 1 - 1
composer.json

@@ -18,7 +18,7 @@
     },
     "require-dev": {
         "phpunit/phpunit": "^5.0",
-        "graylog2/gelf-php": "~1.0",
+        "graylog2/gelf-php": "^1.0.1",
         "sentry/sentry": "^0.13",
         "ruflin/elastica": ">=0.90 <3.0",
         "doctrine/couchdb": "~1.0@dev",

+ 4 - 10
src/Monolog/Handler/GelfHandler.php

@@ -11,9 +11,7 @@
 
 namespace Monolog\Handler;
 
-use Gelf\IMessagePublisher;
 use Gelf\PublisherInterface;
-use Gelf\Publisher;
 use InvalidArgumentException;
 use Monolog\Logger;
 use Monolog\Formatter\GelfMessageFormatter;
@@ -33,18 +31,14 @@ class GelfHandler extends AbstractProcessingHandler
     protected $publisher;
 
     /**
-     * @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object
-     * @param int                                            $level     The minimum logging level at which this handler will be triggered
-     * @param bool                                           $bubble    Whether the messages that are handled can bubble up the stack or not
+     * @param PublisherInterface $publisher a publisher object
+     * @param int                $level     The minimum logging level at which this handler will be triggered
+     * @param bool               $bubble    Whether the messages that are handled can bubble up the stack or not
      */
-    public function __construct($publisher, $level = Logger::DEBUG, $bubble = true)
+    public function __construct(PublisherInterface $publisher, $level = Logger::DEBUG, $bubble = true)
     {
         parent::__construct($level, $bubble);
 
-        if (!$publisher instanceof Publisher && !$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) {
-            throw new InvalidArgumentException('Invalid publisher, expected a Gelf\Publisher, Gelf\IMessagePublisher or Gelf\PublisherInterface instance');
-        }
-
         $this->publisher = $publisher;
     }