Merge "Special:Newpages feed now shows first revision instead of latest revision"
[lhc/web/wiklou.git] / includes / debug / logger / ConsoleLogger.php
1 <?php
2
3 namespace MediaWiki\Logger;
4
5 use Psr\Log\AbstractLogger;
6
7 /**
8 * A logger which writes to the terminal. The output is supposed to be
9 * human-readable, and should be changed as necessary to better achieve that
10 * goal.
11 */
12 class ConsoleLogger extends AbstractLogger {
13 public function __construct( $channel ) {
14 $this->channel = $channel;
15 }
16
17 public function log( $level, $message, array $context = [] ) {
18 fwrite( STDERR, "[$level] " .
19 LegacyLogger::format( $this->channel, $message, $context ) );
20 }
21 }