MediaWiki master
LegacySpi.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Logger;
8
9use Psr\Log\LoggerInterface;
10
26class LegacySpi implements Spi {
27
31 protected $singletons = [];
32
39 public function getLogger( $channel ) {
40 if ( !isset( $this->singletons[$channel] ) ) {
41 $this->singletons[$channel] = new LegacyLogger( $channel );
42 }
43 return $this->singletons[$channel];
44 }
45
52 public function setLoggerForTest( $channel, ?LoggerInterface $logger = null ) {
53 $ret = $this->singletons[$channel] ?? null;
54 $this->singletons[$channel] = $logger;
55 return $ret;
56 }
57
58}
PSR-3 logger that mimics the historic implementation of MediaWiki's former wfErrorLog logging impleme...
The default service provider for MediaWiki\Logger\LoggerFactory, which creates LegacyLogger objects.
Definition LegacySpi.php:26
getLogger( $channel)
Get a logger instance.
Definition LegacySpi.php:39
setLoggerForTest( $channel, ?LoggerInterface $logger=null)
Definition LegacySpi.php:52
Service provider interface to create \Psr\Log\LoggerInterface objects.
Definition Spi.php:50