scratch – Blame information for rev

Subversion Repositories:
Rev:
Rev Author Line No. Line
115 office 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  
14 use Monolog\Handler\TestHandler;
15 use Monolog\Formatter\LineFormatter;
16 use Monolog\Processor\PsrLogMessageProcessor;
17 use Psr\Log\Test\LoggerInterfaceTest;
18  
19 class PsrLogCompatTest extends LoggerInterfaceTest
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 }