ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Monolog\PsrLogCompatTest Class Reference
+ Inheritance diagram for Monolog\PsrLogCompatTest:
+ Collaboration diagram for Monolog\PsrLogCompatTest:

Public Member Functions

 getLogger ()
 
 getLogs ()
 This must return the log messages in order with a simple formatting: "<LOG LEVEL> <MESSAGE>". More...
 
- Public Member Functions inherited from Psr\Log\Test\LoggerInterfaceTest
 getLogger ()
 
 getLogs ()
 This must return the log messages in order with a simple formatting: "<LOG LEVEL> <MESSAGE>". More...
 
 testImplements ()
 
 testLogsAtAllLevels ($level, $message)
 @dataProvider provideLevelsAndMessages More...
 
 provideLevelsAndMessages ()
 
 testThrowsOnInvalidLevel ()
 @expectedException Psr\Log\InvalidArgumentException More...
 
 testContextReplacement ()
 
 testObjectCastToString ()
 
 testContextCanContainAnything ()
 
 testContextExceptionKeyCanBeExceptionOrOtherValues ()
 

Private Attributes

 $handler
 

Detailed Description

Definition at line 19 of file PsrLogCompatTest.php.

Member Function Documentation

◆ getLogger()

Monolog\PsrLogCompatTest::getLogger ( )
Returns
LoggerInterface

Reimplemented from Psr\Log\Test\LoggerInterfaceTest.

Definition at line 23 of file PsrLogCompatTest.php.

24 {
25 $logger = new Logger('foo');
26 $logger->pushHandler($handler = new TestHandler);
27 $logger->pushProcessor(new PsrLogMessageProcessor);
28 $handler->setFormatter(new LineFormatter('%level_name% %message%'));
29
30 $this->handler = $handler;
31
32 return $logger;
33 }

◆ getLogs()

Monolog\PsrLogCompatTest::getLogs ( )

This must return the log messages in order with a simple formatting: "<LOG LEVEL> <MESSAGE>".

Example ->error('Foo') would yield "error Foo"

Returns
string[]

Reimplemented from Psr\Log\Test\LoggerInterfaceTest.

Definition at line 35 of file PsrLogCompatTest.php.

36 {
37 $convert = function ($record) {
38 $lower = function ($match) {
39 return strtolower($match[0]);
40 };
41
42 return preg_replace_callback('{^[A-Z]+}', $lower, $record['formatted']);
43 };
44
45 return array_map($convert, $this->handler->getRecords());
46 }

Field Documentation

◆ $handler

Monolog\PsrLogCompatTest::$handler
private

Definition at line 21 of file PsrLogCompatTest.php.


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