MediaWiki master
MediaWiki\Logger\Monolog\MwlogHandler Class Reference

Write logs to syslog with the channel appended to the application name. More...

Inherits SyslogUdpHandler.

Collaboration diagram for MediaWiki\Logger\Monolog\MwlogHandler:

Public Member Functions

 __construct ( $appprefix, $host, $port=514, $facility=LOG_USER, $level=Logger::DEBUG, $bubble=true)
 

Protected Member Functions

 syslogHeader ( $severity, $app)
 
 write (array $record)
 

Detailed Description

Write logs to syslog with the channel appended to the application name.

This use case for this handler is to emulate Wikimedia Foundation's udp2log system by leveraging syslog (and e.g. Rsyslog/Kafka) and allow an unstructured string to pass through mostly as-is, with the exception of the channel name, which is encoded in transit as part of the syslog "application name". It is intended that the syslog consumer "wildcard" subscribes to all messages with the app prefix, and then * strips it off at some point before writing the messages to a log file named after the channel.

Transition plan (2016):

Stability: unstable
Since
1.32
Note
© 2019 Wikimedia Foundation and contributors

Definition at line 47 of file MwlogHandler.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Logger\Monolog\MwlogHandler::__construct ( $appprefix,
$host,
$port = 514,
$facility = LOG_USER,
$level = Logger::DEBUG,
$bubble = true )
Parameters
string$appprefixApplication prefix to use, channel will be appended.
string$hostSyslog host
int$portSyslog port
int$facilitySyslog message facility
int$levelThe minimum logging level at which this handler will be triggered
bool$bubbleWhether the messages that are handled can bubble up the stack or not

Definition at line 69 of file MwlogHandler.php.

Member Function Documentation

◆ syslogHeader()

MediaWiki\Logger\Monolog\MwlogHandler::syslogHeader ( $severity,
$app )
protected

Definition at line 82 of file MwlogHandler.php.

◆ write()

MediaWiki\Logger\Monolog\MwlogHandler::write ( array $record)
protected

Definition at line 102 of file MwlogHandler.php.


The documentation for this class was generated from the following file: