*/
private static $spi;
-
/**
* Register a service provider to create new \Psr\Log\LoggerInterface
* instances.
self::$spi = $provider;
}
-
/**
* Get the registered service provider.
*
return self::$spi;
}
-
/**
* Get a named logger instance from the currently configured logger factory.
*
* @return \Psr\Log\LoggerInterface
*/
public static function getInstance( $channel ) {
- static $hasPSR3Interface = null;
- if ( $hasPSR3Interface === null ) {
- $hasPSR3Interface = interface_exists( '\Psr\Log\LoggerInterface' );
- if ( !$hasPSR3Interface ) {
- $message = (
- 'MediaWiki requires the <a href="https://github.com/php-fig/log">PSR-3 logging ' .
- "library</a> to be present. This library is not embedded directly in MediaWiki's " .
- "git repository and must be installed separately by the end user.\n\n" .
- 'Please see <a href="https://www.mediawiki.org/wiki/Download_from_Git' .
- '#Fetch_external_libraries">mediawiki.org</a> for help on installing ' .
- 'the required components.'
- );
- echo $message;
- trigger_error( $message, E_USER_ERROR );
- die( 1 );
- }
- }
-
return self::getProvider()->getLogger( $channel );
}
-
/**
* Construction of utility class is not allowed.
*/