MediaWiki
REL1_30
SyslogHandler.php
Go to the documentation of this file.
1
<?php
21
namespace
MediaWiki\Logger\Monolog
;
22
23
use Monolog\Handler\SyslogUdpHandler;
24
use Monolog\Logger;
25
48
class
SyslogHandler
extends
SyslogUdpHandler {
49
53
private
$appname
;
54
58
private
$hostname
;
59
70
public
function
__construct
(
71
$appname
,
72
$host,
73
$port = 514,
74
$facility = LOG_USER,
75
$level = Logger::DEBUG,
76
$bubble =
true
77
) {
78
parent::__construct( $host, $port, $facility, $level, $bubble );
79
$this->appname =
$appname
;
80
$this->hostname = php_uname(
'n'
);
81
}
82
83
protected
function
makeCommonSyslogHeader
( $severity ) {
84
$pri = $severity + $this->facility;
85
86
// Goofy date format courtesy of RFC 3164 :(
87
// RFC 3164 actually specifies that the day of month should be space
88
// padded rather than unpadded but this seems to work with rsyslog and
89
// Logstash.
90
$timestamp = date(
'M j H:i:s'
);
91
92
return
"<{$pri}>{$timestamp} {$this->hostname} {$this->appname}: "
;
93
}
94
}
MediaWiki\Logger\Monolog\SyslogHandler
Log handler that supports sending log events to a syslog server using RFC 3164 formatted UDP packets.
Definition
SyslogHandler.php:48
MediaWiki\Logger\Monolog\SyslogHandler\$hostname
$hostname
Definition
SyslogHandler.php:58
MediaWiki\Logger\Monolog\SyslogHandler\makeCommonSyslogHeader
makeCommonSyslogHeader( $severity)
Definition
SyslogHandler.php:83
MediaWiki\Logger\Monolog\SyslogHandler\$appname
$appname
Definition
SyslogHandler.php:53
MediaWiki\Logger\Monolog\SyslogHandler\__construct
__construct( $appname, $host, $port=514, $facility=LOG_USER, $level=Logger::DEBUG, $bubble=true)
Definition
SyslogHandler.php:70
MediaWiki\Logger\Monolog
Definition
AvroFormatter.php:21
includes
debug
logger
monolog
SyslogHandler.php
Generated on Mon Nov 25 2024 15:42:15 for MediaWiki by
1.10.0