ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PsrLogCompatTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the Monolog package.
5  *
6  * (c) Jordi Boggiano <j.boggiano@seld.be>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
12 namespace Monolog;
13 
18 
20 {
21  private $handler;
22 
23  public function getLogger()
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  }
34 
35  public function getLogs()
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  }
47 }
Monolog log channel.
Definition: Logger.php:28
Provides a base test class for ensuring compliance with the LoggerInterface.
Processes a record&#39;s message according to PSR-3 rules.
Used for testing purposes.
Definition: TestHandler.php:66
Formats incoming records into a one-line string.
$handler