1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 13:16:39 +02:00

Fix BC break and formatting

This commit is contained in:
Jordi Boggiano
2017-03-17 22:52:50 +01:00
committed by GitHub
parent 8c40211c3f
commit aeb65fa050

View File

@@ -27,12 +27,12 @@ class SyslogUdpHandler extends AbstractSyslogHandler
/** /**
* @param string $host * @param string $host
* @param int $port * @param int $port
* @param string $ident Program name or tag for each log message.
* @param mixed $facility * @param mixed $facility
* @param int $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $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.
*/ */
public function __construct($host, $port = 514, $ident = 'php', $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $ident = 'php')
{ {
parent::__construct($facility, $level, $bubble); parent::__construct($facility, $level, $bubble);
@@ -73,17 +73,19 @@ class SyslogUdpHandler extends AbstractSyslogHandler
{ {
$priority = $severity + $this->facility; $priority = $severity + $this->facility;
if(!$pid = getmypid()) if (!$pid = getmypid()) {
$pid = '-'; $pid = '-';
}
if(!$hostname = gethostname()) if (!$hostname = gethostname()) {
$hostname = '-'; $hostname = '-';
}
return "<$priority>1 ". return "<$priority>1 " .
$this->getDateTime()." ". $this->getDateTime() . " " .
$hostname." ". $hostname . " " .
$this->ident." ". $this->ident . " " .
$pid." - - "; $pid . " - - ";
} }
protected function getDateTime() protected function getDateTime()