MediaWiki  1.27.2
TestLogger Class Reference

A logger that may be configured to either buffer logs or to print them to the output where PHPUnit will complain about them. More...

Inheritance diagram for TestLogger:
Collaboration diagram for TestLogger:

Public Member Functions

 __construct ($collect=false, $filter=null)
 
 clearBuffer ()
 Clear the collected log buffer. More...
 
 getBuffer ()
 Return the collected logs. More...
 
 log ($level, $message, array $context=[])
 
 setCollect ($collect)
 Set the "collect" flag. More...
 

Private Attributes

 $buffer = []
 
 $collect = false
 
 $filter = null
 

Detailed Description

A logger that may be configured to either buffer logs or to print them to the output where PHPUnit will complain about them.

Since
1.27

Definition at line 34 of file TestLogger.php.

Constructor & Destructor Documentation

TestLogger::__construct (   $collect = false,
  $filter = null 
)
Parameters
bool$collectWhether to collect logs
callable$filterFilter logs before collecting/printing. Signature is string|null function ( string $message, string $level );

Definition at line 44 of file TestLogger.php.

References $collect, and $filter.

Member Function Documentation

TestLogger::clearBuffer ( )

Clear the collected log buffer.

Definition at line 68 of file TestLogger.php.

TestLogger::getBuffer ( )

Return the collected logs.

Returns
array Array of array( string $level, string $message )

Definition at line 61 of file TestLogger.php.

References $buffer.

TestLogger::log (   $level,
  $message,
array  $context = [] 
)

Definition at line 72 of file TestLogger.php.

TestLogger::setCollect (   $collect)

Set the "collect" flag.

Parameters
bool$collect

Definition at line 53 of file TestLogger.php.

References $collect.

Member Data Documentation

TestLogger::$buffer = []
private

Definition at line 36 of file TestLogger.php.

Referenced by getBuffer().

TestLogger::$collect = false
private

Definition at line 35 of file TestLogger.php.

Referenced by __construct(), and setCollect().

TestLogger::$filter = null
private

Definition at line 37 of file TestLogger.php.

Referenced by __construct().


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