MediaWiki REL1_33
SyslogHandler.php
Go to the documentation of this file.
1<?php
22
25
48class SyslogHandler extends SyslogUdpHandler {
49
53 private $appname;
54
58 private $hostname;
59
70 public function __construct(
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}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Log handler that supports sending log events to a syslog server using RFC 3164 formatted UDP packets.
__construct( $appname, $host, $port=514, $facility=LOG_USER, $level=Logger::DEBUG, $bubble=true)