MediaWiki
1.30.0
|
PSR-3 logger that mimics the historic implementation of MediaWiki's wfErrorLog logging implementation. More...
Public Member Functions | |
__construct ( $channel) | |
log ( $level, $message, array $context=[]) | |
Logs with an arbitrary level. More... | |
Static Public Member Functions | |
static | emit ( $text, $file) |
Log to a file without getting "file size exceeded" signals. More... | |
static | format ( $channel, $message, $context) |
Format a message. More... | |
static | interpolate ( $message, array $context) |
Interpolate placeholders in logging message. More... | |
static | shouldEmit ( $channel, $message, $level, $context) |
Determine if the given message should be emitted or not. More... | |
Static Protected Member Functions | |
static | destination ( $channel, $message, $context) |
Select the appropriate log output destination for the given log event. More... | |
static | flatten ( $item) |
Convert a logging context element to a string suitable for interpolation. More... | |
static | formatAsWfDebug ( $channel, $message, $context) |
Format a message as wfDebug() would have formatted it. More... | |
static | formatAsWfDebugLog ( $channel, $message, $context) |
Format a message as `wfDebugLog() would have formatted it. More... | |
static | formatAsWfLogDBError ( $channel, $message, $context) |
Format a message as wfLogDBError() would have formatted it. More... | |
Protected Attributes | |
$channel | |
Static Protected Attributes | |
static array | $dbChannels |
static | $levelMapping |
Convert \Psr\Log\LogLevel constants into int for sane comparisons These are the same values that Monlog uses. More... | |
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.
Definition at line 48 of file LegacyLogger.php.
MediaWiki\Logger\LegacyLogger::__construct | ( | $channel | ) |
string | $channel |
Definition at line 83 of file LegacyLogger.php.
References MediaWiki\Logger\LegacyLogger\$channel.
|
staticprotected |
Select the appropriate log output destination for the given log event.
If the event context contains 'destination'
string | $channel | |
string | $message | |
array | $context |
Definition at line 426 of file LegacyLogger.php.
References MediaWiki\Logger\LegacyLogger\$channel, MediaWiki\$context, $wgDBerrorLog, $wgDebugLogFile, $wgDebugLogGroups, and global.
Referenced by MediaWiki\Logger\LegacyLogger\log().
|
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.
string | $text | |
string | $file | Filename |
Definition at line 465 of file LegacyLogger.php.
References UDPTransport\newFromString().
Referenced by MediaWiki\Logger\LegacyLogger\log().
|
staticprotected |
Convert a logging context element to a string suitable for interpolation.
mixed | $item |
Definition at line 364 of file LegacyLogger.php.
References captcha-old\count.
Referenced by MediaWiki\Logger\LegacyLogger\interpolate().
|
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.
string | $channel | |
string | $message | |
array | $context |
Definition at line 205 of file LegacyLogger.php.
References MediaWiki\Logger\LegacyLogger\$channel, MediaWiki\$context, $e, $wgDebugLogGroups, $wgLogExceptionBacktrace, MediaWiki\Logger\LegacyLogger\formatAsWfDebug(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), MediaWiki\Logger\LegacyLogger\formatAsWfLogDBError(), MWExceptionHandler\getRedactedTrace(), global, MediaWiki\Logger\LegacyLogger\interpolate(), and MWExceptionHandler\prettyPrintTrace().
Referenced by MediaWiki\Logger\Monolog\LegacyFormatter\format(), MediaWiki\Logger\ConsoleLogger\log(), and MediaWiki\Logger\LegacyLogger\log().
|
staticprotected |
Format a message as wfDebug()
would have formatted it.
string | $channel | |
string | $message | |
array | $context |
Definition at line 284 of file LegacyLogger.php.
References MediaWiki\$context.
Referenced by MediaWiki\Logger\LegacyLogger\format().
|
staticprotected |
Format a message as `wfDebugLog() would have formatted it.
string | $channel | |
string | $message | |
array | $context |
Definition at line 331 of file LegacyLogger.php.
References $time, wfHostname(), wfTimestamp(), and wfWikiID().
Referenced by MediaWiki\Logger\LegacyLogger\format().
|
staticprotected |
Format a message as wfLogDBError()
would have formatted it.
string | $channel | |
string | $message | |
array | $context |
Definition at line 305 of file LegacyLogger.php.
References $wgDBerrorLogTZ, global, wfHostname(), and wfWikiID().
Referenced by MediaWiki\Logger\LegacyLogger\format().
|
static |
Interpolate placeholders in logging message.
string | $message | |
array | $context |
Definition at line 346 of file LegacyLogger.php.
References MediaWiki\$context, as, and MediaWiki\Logger\LegacyLogger\flatten().
Referenced by MediaWiki\Logger\LegacyLogger\format(), and MediaWiki\Logger\LegacyLoggerTest\testInterpolate().
MediaWiki\Logger\LegacyLogger::log | ( | $level, | |
$message, | |||
array | $context = [] |
||
) |
Logs with an arbitrary level.
string | int | $level | |
string | $message | |
array | $context |
Definition at line 95 of file LegacyLogger.php.
References MediaWiki\Logger\LegacyLogger\$channel, MediaWiki\$context, MWDebug\debugMsg(), MediaWiki\Logger\LegacyLogger\destination(), MediaWiki\Logger\LegacyLogger\emit(), MediaWiki\Logger\LegacyLogger\format(), and MWDebug\query().
|
static |
Determine if the given message should be emitted or not.
string | $channel | |
string | $message | |
string | int | $level | \Psr\Log\LogEvent constant or Monolog level int |
array | $context |
Definition at line 136 of file LegacyLogger.php.
References MediaWiki\Logger\LegacyLogger\$channel, MediaWiki\$context, $wgDBerrorLog, $wgDebugLogFile, $wgDebugLogGroups, and global.
Referenced by MediaWiki\Logger\LegacyLoggerTest\testShouldEmit(), and MediaWiki\Logger\Monolog\LegacyHandler\write().
|
protected |
Definition at line 53 of file LegacyLogger.php.
Referenced by MediaWiki\Logger\LegacyLogger\__construct(), MediaWiki\Logger\LegacyLogger\destination(), MediaWiki\Logger\LegacyLogger\format(), MediaWiki\Logger\LegacyLogger\log(), and MediaWiki\Logger\LegacyLogger\shouldEmit().
|
staticprotected |
Definition at line 75 of file LegacyLogger.php.
|
staticprotected |
Convert \Psr\Log\LogLevel constants into int for sane comparisons These are the same values that Monlog uses.
Definition at line 61 of file LegacyLogger.php.