|
MediaWiki master
|
PSR-3 logger that mimics the historic implementation of MediaWiki's former wfErrorLog logging implementation. More...
Inherits AbstractLogger.

Public Member Functions | |
| __construct ( $channel) | |
| log ( $level, $message, array $context=[]) | |
| Logs with an arbitrary level. | |
| setMinimumForTest (?int $level) | |
| Change an existing Logger singleton to act like NullLogger. | |
Static Public Member Functions | |
| static | emit ( $text, $file) |
| Log to a file without getting "file size exceeded" signals. | |
| static | format ( $channel, $message, $context) |
| Format a message. | |
| static | interpolate ( $message, array $context) |
| Interpolate placeholders in logging message. | |
| static | shouldEmit ( $channel, $message, $level, $context) |
| Determine if the given message should be emitted or not. | |
Static Protected Member Functions | |
| static | destination ( $channel, $message, $context) |
| Select the appropriate log output destination for the given log event. | |
| static | flatten ( $item) |
| Convert a logging context element to a string suitable for interpolation. | |
| static | formatAsWfDebug ( $channel, $message, $context) |
Format a message as wfDebug() would have formatted it. | |
| static | formatAsWfDebugLog ( $channel, $message, $context) |
| Format a message as `wfDebugLog() would have formatted it. | |
| static | formatAsWfLogDBError ( $channel, $message, $context) |
Format a message as wfLogDBError() would have formatted it. | |
Protected Attributes | |
| string | $channel |
Static Protected Attributes | |
| static array | $levelMapping |
| Convert \Psr\Log\LogLevel constants into int for sensible comparisons These are the same values that Monolog uses. | |
PSR-3 logger that mimics the historic implementation of MediaWiki's former wfErrorLog logging implementation.
This logger is configured by the following global configuration variables:
$wgDebugLogFile$wgDebugLogGroups$wgDBerrorLog$wgDBerrorLogTZSee docs/Configuration.md for detailed explanations of these settings.
Definition at line 40 of file LegacyLogger.php.
| MediaWiki\Logger\LegacyLogger::__construct | ( | $channel | ) |
| string | $channel |
Definition at line 92 of file LegacyLogger.php.
References MediaWiki\Logger\LegacyLogger\$channel, $wgDBerrorLog, $wgDebugLogFile, $wgDebugLogGroups, $wgDebugRawPage, $wgDebugToolbar, $wgShowDebug, and wfIsDebugRawPage().
|
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 461 of file LegacyLogger.php.
References $wgDBerrorLog, $wgDebugLogFile, and $wgDebugLogGroups.
|
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 500 of file LegacyLogger.php.
|
staticprotected |
Convert a logging context element to a string suitable for interpolation.
| mixed | $item |
Definition at line 397 of file LegacyLogger.php.
|
static |
Format a message.
Messages to the 'wfDebug' and 'wfLogDBError' channels receive special formatting 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 269 of file LegacyLogger.php.
References $wgDebugLogGroups, and $wgLogExceptionBacktrace.
Referenced by MediaWiki\Logger\ConsoleLogger\log().
|
staticprotected |
Format a message as wfDebug() would have formatted it.
| string | $channel | |
| string | $message | |
| array | $context |
Definition at line 317 of file LegacyLogger.php.
|
staticprotected |
Format a message as `wfDebugLog() would have formatted it.
| string | $channel | |
| string | $message | |
| array | $context |
Definition at line 364 of file LegacyLogger.php.
References wfHostname().
|
staticprotected |
Format a message as wfLogDBError() would have formatted it.
| string | $channel | |
| string | $message | |
| array | $context |
Definition at line 338 of file LegacyLogger.php.
References $wgDBerrorLogTZ, and wfHostname().
|
static |
Interpolate placeholders in logging message.
| string | $message | |
| array | $context |
Definition at line 379 of file LegacyLogger.php.
Referenced by MediaWiki\Debug\MWDebug\debugMsg().
| MediaWiki\Logger\LegacyLogger::log | ( | $level, | |
| $message, | |||
| array | $context = [] ) |
Logs with an arbitrary level.
| string | int | $level | |
| string | $message | |
| array | $context |
Definition at line 147 of file LegacyLogger.php.
| MediaWiki\Logger\LegacyLogger::setMinimumForTest | ( | ?int | $level | ) |
Change an existing Logger singleton to act like NullLogger.
| null | int | $level |
Definition at line 130 of file LegacyLogger.php.
|
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 205 of file LegacyLogger.php.
References $wgDBerrorLog, $wgDebugLogFile, and $wgDebugLogGroups.
|
protected |
Definition at line 45 of file LegacyLogger.php.
Referenced by MediaWiki\Logger\LegacyLogger\__construct().
|
staticprotected |
Convert \Psr\Log\LogLevel constants into int for sensible comparisons These are the same values that Monolog uses.
Definition at line 63 of file LegacyLogger.php.