MediaWiki
REL1_35
LoggerFactory.php
Go to the documentation of this file.
1
<?php
21
namespace
MediaWiki\Logger
;
22
23
use Wikimedia\ObjectFactory;
24
45
class
LoggerFactory
{
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
) {
77
global
$wgMWLoggerDefaultSpi
;
78
$provider = ObjectFactory::getObjectFromSpec(
79
$wgMWLoggerDefaultSpi
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
$wgMWLoggerDefaultSpi
Default service provider for creating Psr\Log\LoggerInterface instances.
Definition
DefaultSettings.php:6751
MediaWiki\Logger\LoggerFactory
PSR-3 logger instance factory.
Definition
LoggerFactory.php:45
MediaWiki\Logger\LoggerFactory\registerProvider
static registerProvider(Spi $provider)
Register a service provider to create new \Psr\Log\LoggerInterface instances.
Definition
LoggerFactory.php:59
MediaWiki\Logger\LoggerFactory\getInstance
static getInstance( $channel)
Get a named logger instance from the currently configured logger factory.
Definition
LoggerFactory.php:92
MediaWiki\Logger\LoggerFactory\__construct
__construct()
Construction of utility class is not allowed.
Definition
LoggerFactory.php:99
MediaWiki\Logger\LoggerFactory\$spi
static $spi
Service provider.
Definition
LoggerFactory.php:51
MediaWiki\Logger\LoggerFactory\getProvider
static getProvider()
Get the registered service provider.
Definition
LoggerFactory.php:75
MediaWiki\Logger\Spi
Service provider interface for \Psr\Log\LoggerInterface implementation libraries.
Definition
Spi.php:38
MediaWiki\Logger
Definition
ConsoleLogger.php:3
includes
debug
logger
LoggerFactory.php
Generated on Sat Apr 6 2024 00:07:04 for MediaWiki by
1.9.8