MediaWiki  1.28.0
MediaWiki\Logger\LoggerFactory Class Reference

PSR-3 logger instance factory. More...

Static Public Member Functions

static getInstance ($channel)
 Get a named logger instance from the currently configured logger factory. More...
 
static getProvider ()
 Get the registered service provider. More...
 
static registerProvider (Spi $provider)
 Register a service provider to create new \Psr\Log\LoggerInterface instances. More...
 

Private Member Functions

 __construct ()
 Construction of utility class is not allowed. More...
 

Static Private Attributes

static $spi
 Service provider. More...
 

Detailed Description

PSR-3 logger instance factory.

Creation of \Psr\Log\LoggerInterface instances is managed via the LoggerFactory::getInstance() static method which in turn delegates to the currently registered service provider.

A service provider is any class implementing the Spi interface. There are two possible methods of registering a service provider. The LoggerFactory::registerProvider() static method can be called at any time to change the service provider. If LoggerFactory::getInstance() is called before any service provider has been registered, it will attempt to use the $wgMWLoggerDefaultSpi global to bootstrap Spi registration. $wgMWLoggerDefaultSpi is expected to be an array usable by ObjectFactory::getObjectFromSpec() to create a class.

See also
\MediaWiki\Logger\Spi
Since
1.25
Author
Bryan Davis bd808.nosp@m.@wik.nosp@m.imedi.nosp@m.a.or.nosp@m.g
Note
© 2014 Bryan Davis and Wikimedia Foundation.

Definition at line 46 of file LoggerFactory.php.

Constructor & Destructor Documentation

MediaWiki\Logger\LoggerFactory::__construct ( )
private

Construction of utility class is not allowed.

Definition at line 100 of file LoggerFactory.php.

Member Function Documentation

static MediaWiki\Logger\LoggerFactory::getProvider ( )
static

Get the registered service provider.

If called before any service provider has been registered, it will attempt to use the $wgMWLoggerDefaultSpi global to bootstrap Spi registration. $wgMWLoggerDefaultSpi is expected to be an array usable by ObjectFactory::getObjectFromSpec() to create a class.

Returns
\MediaWiki\Logger\Spi
See also
registerProvider()
ObjectFactory::getObjectFromSpec()

Definition at line 76 of file LoggerFactory.php.

References ObjectFactory\getObjectFromSpec(), and global.

static MediaWiki\Logger\LoggerFactory::registerProvider ( Spi  $provider)
static

Register a service provider to create new \Psr\Log\LoggerInterface instances.

Parameters
\\MediaWiki\\Logger\\Spi$providerProvider to register

Definition at line 60 of file LoggerFactory.php.

Member Data Documentation

MediaWiki Logger Spi MediaWiki\Logger\LoggerFactory::$spi
staticprivate

Service provider.

Definition at line 52 of file LoggerFactory.php.


The documentation for this class was generated from the following file: