Movatterモバイル変換


[0]ホーム

URL:


MediaWiki master
LoggerFactory.php
Go to the documentation of this file.
1<?php
7namespaceMediaWiki\Logger;
8
9use LogicException;
10use Wikimedia\ObjectFactory\ObjectFactory;
11
32classLoggerFactory {
33
38privatestatic $spi;
39
40privatestatic ?LoggingContext $context;
41
48publicstaticfunctionregisterProvider(Spi $provider ) {
49 self::$spi = $provider;
50 }
51
64publicstaticfunctiongetProvider() {
65if ( self::$spi ===null ) {
67 $provider = ObjectFactory::getObjectFromSpec(
69 );
70self::registerProvider( $provider );
71 }
72return self::$spi;
73 }
74
81publicstaticfunctiongetInstance( $channel ) {
82returnself::getProvider()->getLogger( $channel );
83 }
84
89publicstaticfunctiongetContext():LoggingContext {
90 self::$context ??= newLoggingContext();
91return self::$context;
92 }
93
99publicstaticfunctionsetContext(LoggingContext $context ): void {
100if ( !defined('MW_PHPUNIT_TEST' ) ) {
101thrownew LogicException( __METHOD__ .' can only be used in PHPUnit tests' );
102 }
103 self::$context = $context;
104 }
105
109privatefunction __construct() {
110// no-op
111 }
112}
if
if(!defined('MW_SETUP_CALLBACK'))
DefinitionWebStart.php:68
MediaWiki\Logger\LoggerFactory
Create PSR-3 logger objects.
DefinitionLoggerFactory.php:32
MediaWiki\Logger\LoggerFactory\registerProvider
static registerProvider(Spi $provider)
Register a service provider to create new \Psr\Log\LoggerInterface instances.
DefinitionLoggerFactory.php:48
MediaWiki\Logger\LoggerFactory\getInstance
static getInstance( $channel)
Get a named logger instance from the currently configured logger factory.
DefinitionLoggerFactory.php:81
MediaWiki\Logger\LoggerFactory\setContext
static setContext(LoggingContext $context)
Replace the logging context, for testing.
DefinitionLoggerFactory.php:99
MediaWiki\Logger\LoggerFactory\getContext
static getContext()
Get a logging context, which can be used to add information to all log events.
DefinitionLoggerFactory.php:89
MediaWiki\Logger\LoggerFactory\getProvider
static getProvider()
Get the registered service provider.
DefinitionLoggerFactory.php:64
MediaWiki\Logger\LoggingContext
A helper class for adding extra context to all logs, without the logging code having to be aware.
DefinitionLoggingContext.php:14
$wgMWLoggerDefaultSpi
$wgMWLoggerDefaultSpi
Config variable stub for the MWLoggerDefaultSpi setting, for use by phpdoc and IDEs.
Definitionconfig-vars.php:3288
MediaWiki\Logger\Spi
Service provider interface to create \Psr\Log\LoggerInterface objects.
DefinitionSpi.php:50
MediaWiki\Logger
DefinitionConsoleLogger.php:3
MediaWiki
Helper trait for implementations \DAO.

[8]ページ先頭

©2009-2025 Movatter.jp