Skip to content

Commit

Permalink
Merge pull request #1572 from mimmi20/main
Browse files Browse the repository at this point in the history
add check for required extension
  • Loading branch information
Seldaek authored Sep 14, 2021
2 parents 9638f0d + 71cf94a commit 73af18b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Monolog/Handler/SyslogUdpHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ class SyslogUdpHandler extends AbstractSyslogHandler
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
* @param string $ident Program name or tag for each log message.
* @param int $rfc RFC to format the message for.
* @throws MissingExtensionException
*
* @phpstan-param self::RFC* $rfc
*/
public function __construct(string $host, int $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, bool $bubble = true, string $ident = 'php', int $rfc = self::RFC5424)
{
if (!extension_loaded('sockets')) {
throw new MissingExtensionException('The sockets extension is required to use the SyslogUdpHandler');
}

parent::__construct($facility, $level, $bubble);

$this->ident = $ident;
Expand Down

0 comments on commit 73af18b

Please sign in to comment.