MediaWiki master
LegacySpi.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Logger;
22
23use Psr\Log\LoggerInterface;
24
40class LegacySpi implements Spi {
41
45 protected $singletons = [];
46
53 public function getLogger( $channel ) {
54 if ( !isset( $this->singletons[$channel] ) ) {
55 $this->singletons[$channel] = new LegacyLogger( $channel );
56 }
57 return $this->singletons[$channel];
58 }
59
66 public function setLoggerForTest( $channel, LoggerInterface $logger = null ) {
67 $ret = $this->singletons[$channel] ?? null;
68 $this->singletons[$channel] = $logger;
69 return $ret;
70 }
71
72}
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:40
getLogger( $channel)
Get a logger instance.
Definition LegacySpi.php:53
setLoggerForTest( $channel, LoggerInterface $logger=null)
Definition LegacySpi.php:66
Service provider interface to create \Psr\Log\LoggerInterface objects.
Definition Spi.php:64