summaryrefslogtreecommitdiff
path: root/www/wiki/includes/debug/logger/ConsoleLogger.php
blob: 5a5e507195b74ab082d2c8e7e6e86dda98938fb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

namespace MediaWiki\Logger;

use Psr\Log\AbstractLogger;

/**
 * A logger which writes to the terminal. The output is supposed to be
 * human-readable, and should be changed as necessary to better achieve that
 * goal.
 */
class ConsoleLogger extends AbstractLogger {
	public function __construct( $channel ) {
		$this->channel = $channel;
	}

	public function log( $level, $message, array $context = [] ) {
		fwrite( STDERR, "[$level] " .
			LegacyLogger::format( $this->channel, $message, $context ) );
	}
}