MediaWiki REL1_37
LegacySpi.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Logger;
22
23use Psr\Log\LoggerInterface;
24
39class 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}
PSR-3 logger that mimics the historic implementation of MediaWiki's former wfErrorLog logging impleme...
LoggerFactory service provider that creates LegacyLogger instances.
Definition LegacySpi.php:39
getLogger( $channel)
Get a logger instance.
Definition LegacySpi.php:52
setLoggerForTest( $channel, LoggerInterface $logger=null)
Definition LegacySpi.php:65
Service provider interface for \Psr\Log\LoggerInterface implementation libraries.
Definition Spi.php:38