summaryrefslogtreecommitdiffstats
path: root/src/Monolog/Handler/GelfHandler.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Monolog/Handler/GelfHandler.php')
-rw-r--r--src/Monolog/Handler/GelfHandler.php22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/Monolog/Handler/GelfHandler.php b/src/Monolog/Handler/GelfHandler.php
index d3847d8..b5c3a8c 100644
--- a/src/Monolog/Handler/GelfHandler.php
+++ b/src/Monolog/Handler/GelfHandler.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
/*
* This file is part of the Monolog package.
@@ -11,12 +11,10 @@
namespace Monolog\Handler;
-use Gelf\IMessagePublisher;
use Gelf\PublisherInterface;
-use Gelf\Publisher;
-use InvalidArgumentException;
use Monolog\Logger;
use Monolog\Formatter\GelfMessageFormatter;
+use Monolog\Formatter\FormatterInterface;
/**
* Handler to send messages to a Graylog2 (http://www.graylog2.org) server
@@ -27,23 +25,19 @@ use Monolog\Formatter\GelfMessageFormatter;
class GelfHandler extends AbstractProcessingHandler
{
/**
- * @var Publisher the publisher object that sends the message to the server
+ * @var PublisherInterface|null the publisher object that sends the message to the server
*/
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;
}
@@ -66,7 +60,7 @@ class GelfHandler extends AbstractProcessingHandler
/**
* {@inheritDoc}
*/
- protected function getDefaultFormatter()
+ protected function getDefaultFormatter(): FormatterInterface
{
return new GelfMessageFormatter();
}