MediaWiki  1.34.0
MediaWiki\Logger\LogCapturingSpi Class Reference

Wraps another spi to capture all logs generated. More...

Inheritance diagram for MediaWiki\Logger\LogCapturingSpi:
Collaboration diagram for MediaWiki\Logger\LogCapturingSpi:

Public Member Functions

 __construct (Spi $inner)
 
 capture ( $log)
 
 getLogger ( $channel)
 
 getLogs ()
 

Private Member Functions

 createLogger ( $channel)
 

Private Attributes

Spi $inner
 
array $logs = []
 
LoggerInterface[] $singletons
 

Detailed Description

Wraps another spi to capture all logs generated.

This can be used, for example, to collect all logs generated during a unit test and report them when the test fails.

Definition at line 13 of file LogCapturingSpi.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Logger\LogCapturingSpi::__construct ( Spi  $inner)

Member Function Documentation

◆ capture()

MediaWiki\Logger\LogCapturingSpi::capture (   $log)
Parameters
array$log

Definition at line 46 of file LogCapturingSpi.php.

Referenced by MediaWiki\Logger\LogCapturingSpi\createLogger().

◆ createLogger()

MediaWiki\Logger\LogCapturingSpi::createLogger (   $channel)
private

◆ getLogger()

MediaWiki\Logger\LogCapturingSpi::getLogger (   $channel)
Parameters
string$channel
Returns
LoggerInterface

Implements MediaWiki\Logger\Spi.

Definition at line 36 of file LogCapturingSpi.php.

References MediaWiki\Logger\LogCapturingSpi\createLogger().

◆ getLogs()

MediaWiki\Logger\LogCapturingSpi::getLogs ( )
Returns
array

Definition at line 28 of file LogCapturingSpi.php.

References MediaWiki\Logger\LogCapturingSpi\$logs.

Member Data Documentation

◆ $inner

Spi MediaWiki\Logger\LogCapturingSpi::$inner
private

◆ $logs

array MediaWiki\Logger\LogCapturingSpi::$logs = []
private

Definition at line 19 of file LogCapturingSpi.php.

Referenced by MediaWiki\Logger\LogCapturingSpi\getLogs().

◆ $singletons

LoggerInterface [] MediaWiki\Logger\LogCapturingSpi::$singletons
private

Definition at line 15 of file LogCapturingSpi.php.


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