From e46fecde340c873dc6100422b00cff732963947a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 20 May 2016 19:55:04 +0100 Subject: [PATCH] Remove support for legacy Gelf lib --- composer.json | 2 +- src/Monolog/Handler/GelfHandler.php | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 6efd2819..7f7bf741 100644 --- a/composer.json +++ b/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", diff --git a/src/Monolog/Handler/GelfHandler.php b/src/Monolog/Handler/GelfHandler.php index cc31ee7a..6642d209 100644 --- a/src/Monolog/Handler/GelfHandler.php +++ b/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; }