MediaWiki REL1_37
LoggerFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Logger;
22
23use Wikimedia\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}
$wgMWLoggerDefaultSpi
Default service provider for creating Psr\Log\LoggerInterface instances.
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.
__construct()
Construction of utility class is not allowed.
static MediaWiki Logger Spi $spi
Service provider.
static getProvider()
Get the registered service provider.
Service provider interface for \Psr\Log\LoggerInterface implementation libraries.
Definition Spi.php:38
A helper class for throttling authentication attempts.