MediaWiki REL1_39
LoggerFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Logger;
22
23use Wikimedia\ObjectFactory\ObjectFactory;
24
46
51 private static $spi;
52
59 public static function registerProvider( Spi $provider ) {
60 self::$spi = $provider;
61 }
62
75 public static function getProvider() {
76 if ( self::$spi === null ) {
78 $provider = ObjectFactory::getObjectFromSpec(
80 );
81 self::registerProvider( $provider );
82 }
83 return self::$spi;
84 }
85
92 public static function getInstance( $channel ) {
93 return self::getProvider()->getLogger( $channel );
94 }
95
99 private function __construct() {
100 // no-op
101 }
102}
PSR-3 logger instance factory.
static registerProvider(Spi $provider)
Register a service provider to create new \Psr\Log\LoggerInterface instances.
static getInstance( $channel)
Get a named logger instance from the currently configured logger factory.
static getProvider()
Get the registered service provider.
$wgMWLoggerDefaultSpi
Config variable stub for the MWLoggerDefaultSpi setting, for use by phpdoc and IDEs.
Service provider interface for \Psr\Log\LoggerInterface implementation libraries.
Definition Spi.php:38
A helper class for throttling authentication attempts.