Merge "Provide command to adjust phpunit.xml for code coverage"
[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 /**
14 * @param string $channel
15 */
16 public function __construct( $channel ) {
17 $this->channel = $channel;
18 }
19
20 /**
21 * @inheritDoc
22 */
23 public function log( $level, $message, array $context = [] ) {
24 fwrite( STDERR, "[$level] " .
25 LegacyLogger::format( $this->channel, $message, $context ) );
26 }
27 }