MediaWiki  1.34.0
ConsoleLogger.php
Go to the documentation of this file.
1 <?php
2 
3 namespace MediaWiki\Logger;
4 
5 use Psr\Log\AbstractLogger;
6 
12 class ConsoleLogger extends AbstractLogger {
14  private $channel;
15 
19  public function __construct( $channel ) {
20  $this->channel = $channel;
21  }
22 
26  public function log( $level, $message, array $context = [] ) {
27  fwrite( STDERR, "[$level] " .
28  LegacyLogger::format( $this->channel, $message, $context ) );
29  }
30 }
MediaWiki\Logger\ConsoleLogger\log
log( $level, $message, array $context=[])
Definition: ConsoleLogger.php:26
MediaWiki\Logger\ConsoleLogger
A logger which writes to the terminal.
Definition: ConsoleLogger.php:12
MediaWiki\Logger\ConsoleLogger\$channel
string $channel
Definition: ConsoleLogger.php:14
MediaWiki\Logger
Definition: ConsoleLogger.php:3
MediaWiki\Logger\ConsoleLogger\__construct
__construct( $channel)
Definition: ConsoleLogger.php:19
MediaWiki\Logger\LegacyLogger\format
static format( $channel, $message, $context)
Format a message.
Definition: LegacyLogger.php:222
MediaWiki\$context
IContextSource $context
Definition: MediaWiki.php:38