mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-22 09:06:10 +02:00
Add Record/Level/LevelName type aliases and improve phpstan type coverage to level 6
This commit is contained in:
@@ -27,14 +27,18 @@ class SyslogUdpHandler extends AbstractSyslogHandler
|
||||
const RFC5424 = 1;
|
||||
const RFC5424e = 2;
|
||||
|
||||
/** @var array<self::RFC*, string> */
|
||||
private $dateFormats = array(
|
||||
self::RFC3164 => 'M d H:i:s',
|
||||
self::RFC5424 => \DateTime::RFC3339,
|
||||
self::RFC5424e => \DateTime::RFC3339_EXTENDED,
|
||||
);
|
||||
|
||||
/** @var UdpSocket */
|
||||
protected $socket;
|
||||
/** @var string */
|
||||
protected $ident;
|
||||
/** @var self::RFC* */
|
||||
protected $rfc;
|
||||
|
||||
/**
|
||||
@@ -45,6 +49,8 @@ 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.
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@@ -72,6 +78,10 @@ class SyslogUdpHandler extends AbstractSyslogHandler
|
||||
$this->socket->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|string[] $message
|
||||
* @return string[]
|
||||
*/
|
||||
private function splitMessageIntoLines($message): array
|
||||
{
|
||||
if (is_array($message)) {
|
||||
|
Reference in New Issue
Block a user