scratch – Blame information for rev 115

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\Handler;
13  
14 use Monolog\Logger;
15 use Psr\Log\LoggerInterface;
16  
17 /**
18 * Proxies log messages to an existing PSR-3 compliant logger.
19 *
20 * @author Michael Moussa <michael.moussa@gmail.com>
21 */
22 class PsrHandler extends AbstractHandler
23 {
24 /**
25 * PSR-3 compliant logger
26 *
27 * @var LoggerInterface
28 */
29 protected $logger;
30  
31 /**
32 * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied
33 * @param int $level The minimum logging level at which this handler will be triggered
34 * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
35 */
36 public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, $bubble = true)
37 {
38 parent::__construct($level, $bubble);
39  
40 $this->logger = $logger;
41 }
42  
43 /**
44 * {@inheritDoc}
45 */
46 public function handle(array $record)
47 {
48 if (!$this->isHandling($record)) {
49 return false;
50 }
51  
52 $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']);
53  
54 return false === $this->bubble;
55 }
56 }