MediaWiki  master
LegacySpi.php
Go to the documentation of this file.
1 <?php
21 namespace MediaWiki\Logger;
22 
23 use Psr\Log\LoggerInterface;
24 
39 class LegacySpi implements Spi {
40 
44  protected $singletons = [];
45 
52  public function getLogger( $channel ) {
53  if ( !isset( $this->singletons[$channel] ) ) {
54  $this->singletons[$channel] = new LegacyLogger( $channel );
55  }
56  return $this->singletons[$channel];
57  }
58 
65  public function setLoggerForTest( $channel, LoggerInterface $logger = null ) {
66  $ret = $this->singletons[$channel] ?? null;
67  $this->singletons[$channel] = $logger;
68  return $ret;
69  }
70 
71 }
MediaWiki\Logger\LegacySpi\setLoggerForTest
setLoggerForTest( $channel, LoggerInterface $logger=null)
Definition: LegacySpi.php:65
MediaWiki\Logger\LegacySpi
LoggerFactory service provider that creates LegacyLogger instances.
Definition: LegacySpi.php:39
MediaWiki\Logger\LegacySpi\getLogger
getLogger( $channel)
Get a logger instance.
Definition: LegacySpi.php:52
MediaWiki\Logger
Definition: ConsoleLogger.php:3
MediaWiki\Logger\LegacySpi\$singletons
array $singletons
Definition: LegacySpi.php:44
MediaWiki\Logger\LegacyLogger
PSR-3 logger that mimics the historic implementation of MediaWiki's former wfErrorLog logging impleme...
Definition: LegacyLogger.php:51
MediaWiki\Logger\Spi
Service provider interface for \Psr\Log\LoggerInterface implementation libraries.
Definition: Spi.php:36