BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
MediaWiki\Logger\LegacyLogger Class Reference
Inheritance diagram for MediaWiki\Logger\LegacyLogger:
Collaboration diagram for MediaWiki\Logger\LegacyLogger:

Public Member Functions

 __construct ($channel)
 
 log ($level, $message, array $context=[])
 
- Public Member Functions inherited from Psr\Log\AbstractLogger
 emergency ($message, array $context=array())
 
 alert ($message, array $context=array())
 
 critical ($message, array $context=array())
 
 error ($message, array $context=array())
 
 warning ($message, array $context=array())
 
 notice ($message, array $context=array())
 
 info ($message, array $context=array())
 
 debug ($message, array $context=array())
 

Static Public Member Functions

static shouldEmit ($channel, $message, $level, $context)
 
static format ($channel, $message, $context)
 
static interpolate ($message, array $context)
 
static emit ($text, $file)
 

Static Protected Member Functions

static formatAsWfDebug ($channel, $message, $context)
 
static formatAsWfLogDBError ($channel, $message, $context)
 
static formatAsWfDebugLog ($channel, $message, $context)
 
static flatten ($item)
 
static destination ($channel, $message, $context)
 

Protected Attributes

 $channel
 

Static Protected Attributes

static $levelMapping
 

Detailed Description

PSR-3 logger that mimics the historic implementation of MediaWiki's wfErrorLog logging implementation.

This logger is configured by the following global configuration variables:

  • $wgDebugLogFile
  • $wgDebugLogGroups
  • $wgDBerrorLog
  • $wgDBerrorLogTZ

See documentation in DefaultSettings.php for detailed explanations of each variable.

See Also
Since
1.25
Author
Bryan Davis bd808.nosp@m.@wik.nosp@m.imedi.nosp@m.a.or.nosp@m.g

Constructor & Destructor Documentation

MediaWiki\Logger\LegacyLogger::__construct (   $channel)
Parameters
string$channel

Member Function Documentation

static MediaWiki\Logger\LegacyLogger::destination (   $channel,
  $message,
  $context 
)
staticprotected

Select the appropriate log output destination for the given log event.

If the event context contains 'destination'

Parameters
string$channel
string$message
array$context
Returns
string
static MediaWiki\Logger\LegacyLogger::emit (   $text,
  $file 
)
static

Log to a file without getting "file size exceeded" signals.

Can also log to UDP with the syntax udp://host:port/prefix. This will send lines to the specified port, prefixed by the specified prefix and a space.

Parameters
string$text
string$fileFilename
Exceptions
MWException
static MediaWiki\Logger\LegacyLogger::flatten (   $item)
staticprotected

Convert a logging context element to a string suitable for interpolation.

Parameters
mixed$item
Returns
string
static MediaWiki\Logger\LegacyLogger::format (   $channel,
  $message,
  $context 
)
static

Format a message.

Messages to the 'wfDebug', 'wfLogDBError' and 'wfErrorLog' channels receive special fomatting to mimic the historic output of the functions of the same name. All other channel values are formatted based on the historic output of the wfDebugLog() global function.

Parameters
string$channel
string$message
array$context
Returns
string
static MediaWiki\Logger\LegacyLogger::formatAsWfDebug (   $channel,
  $message,
  $context 
)
staticprotected

Format a message as wfDebug() would have formatted it.

Parameters
string$channel
string$message
array$context
Returns
string
static MediaWiki\Logger\LegacyLogger::formatAsWfDebugLog (   $channel,
  $message,
  $context 
)
staticprotected

Format a message as `wfDebugLog() would have formatted it.

Parameters
string$channel
string$message
array$context
static MediaWiki\Logger\LegacyLogger::formatAsWfLogDBError (   $channel,
  $message,
  $context 
)
staticprotected

Format a message as wfLogDBError() would have formatted it.

Parameters
string$channel
string$message
array$context
Returns
string
static MediaWiki\Logger\LegacyLogger::interpolate (   $message,
array  $context 
)
static

Interpolate placeholders in logging message.

Parameters
string$message
array$context
Returns
string Interpolated message
MediaWiki\Logger\LegacyLogger::log (   $level,
  $message,
array  $context = [] 
)

Logs with an arbitrary level.

Parameters
string | int$level
string$message
array$context

Implements Psr\Log\LoggerInterface.

static MediaWiki\Logger\LegacyLogger::shouldEmit (   $channel,
  $message,
  $level,
  $context 
)
static

Determine if the given message should be emitted or not.

Parameters
string$channel
string$message
string | int$levelconstant or Monlog level int
array$context
Returns
bool True if message should be sent to disk/network, false otherwise

Member Data Documentation

array MediaWiki\Logger\LegacyLogger::$levelMapping
staticprotected
Initial value:
= [
LogLevel::DEBUG => 100

Convert constants into int for sane comparisons These are the same values that Monlog uses


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