MediaWiki REL1_31
MediaWiki\Logger\Monolog\LegacyHandler Class Reference

Log handler that replicates the behavior of MediaWiki's wfErrorLog() logging service. More...

Inheritance diagram for MediaWiki\Logger\Monolog\LegacyHandler:
Collaboration diagram for MediaWiki\Logger\Monolog\LegacyHandler:

Public Member Functions

 __construct ( $stream, $useLegacyFilter=false, $level=Logger::DEBUG, $bubble=true)
 
 close ()
 

Protected Member Functions

 errorTrap ( $code, $msg)
 Custom error handler.
 
 openSink ()
 Open the log sink described by our stream URI.
 
 useUdp ()
 Should we use UDP to send messages to the sink?
 
 write (array $record)
 

Protected Attributes

 $error
 
 $host
 
 $port
 
 $prefix
 
 $sink
 Log sink.
 
 $uri
 Log sink descriptor.
 
 $useLegacyFilter
 Filter log events using legacy rules.
 

Detailed Description

Log handler that replicates the behavior of MediaWiki's wfErrorLog() logging service.

Log output can be directed to a local file, a PHP stream, or a udp2log server.

For udp2log output, the stream specification must have the form: "udp://HOST:PORT[/PREFIX]" where:

  • HOST: IPv4, IPv6 or hostname
  • PORT: server port
  • PREFIX: optional (but recommended) prefix telling udp2log how to route the log event. The special prefix "{channel}" will use the log event's channel as the prefix value.

When not targeting a udp2log stream this class will act as a drop-in replacement for \Monolog\Handler\StreamHandler.

Since
1.25
Note
© 2013 Wikimedia Foundation and contributors

Definition at line 49 of file LegacyHandler.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Logger\Monolog\LegacyHandler::__construct ( $stream,
$useLegacyFilter = false,
$level = Logger::DEBUG,
$bubble = true )
Parameters
string$streamStream URI
bool$useLegacyFilterFilter log events using legacy rules
int$levelMinimum logging level that will trigger handler
bool$bubbleCan handled meesages bubble up the handler stack?

Definition at line 95 of file LegacyHandler.php.

References MediaWiki\Logger\Monolog\LegacyHandler\$useLegacyFilter.

Member Function Documentation

◆ close()

MediaWiki\Logger\Monolog\LegacyHandler::close ( )

◆ errorTrap()

MediaWiki\Logger\Monolog\LegacyHandler::errorTrap ( $code,
$msg )
protected

Custom error handler.

Parameters
int$codeError number
string$msgError message

Definition at line 166 of file LegacyHandler.php.

◆ openSink()

MediaWiki\Logger\Monolog\LegacyHandler::openSink ( )
protected

Open the log sink described by our stream URI.

Definition at line 109 of file LegacyHandler.php.

Referenced by MediaWiki\Logger\Monolog\LegacyHandler\write().

◆ useUdp()

MediaWiki\Logger\Monolog\LegacyHandler::useUdp ( )
protected

Should we use UDP to send messages to the sink?

Returns
bool

Definition at line 174 of file LegacyHandler.php.

Referenced by MediaWiki\Logger\Monolog\LegacyHandler\close(), and MediaWiki\Logger\Monolog\LegacyHandler\write().

◆ write()

Member Data Documentation

◆ $error

string MediaWiki\Logger\Monolog\LegacyHandler::$error
protected

Definition at line 72 of file LegacyHandler.php.

◆ $host

string MediaWiki\Logger\Monolog\LegacyHandler::$host
protected

Definition at line 77 of file LegacyHandler.php.

◆ $port

int MediaWiki\Logger\Monolog\LegacyHandler::$port
protected

Definition at line 82 of file LegacyHandler.php.

◆ $prefix

string MediaWiki\Logger\Monolog\LegacyHandler::$prefix
protected

Definition at line 87 of file LegacyHandler.php.

Referenced by MediaWiki\Logger\Monolog\LegacyHandler\write().

◆ $sink

resource MediaWiki\Logger\Monolog\LegacyHandler::$sink
protected

Log sink.

Definition at line 67 of file LegacyHandler.php.

◆ $uri

string MediaWiki\Logger\Monolog\LegacyHandler::$uri
protected

Log sink descriptor.

Definition at line 55 of file LegacyHandler.php.

◆ $useLegacyFilter

bool MediaWiki\Logger\Monolog\LegacyHandler::$useLegacyFilter
protected

Filter log events using legacy rules.

Definition at line 61 of file LegacyHandler.php.

Referenced by MediaWiki\Logger\Monolog\LegacyHandler\__construct().


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