equal
deleted
inserted
replaced
|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Symfony package. |
|
5 * |
|
6 * (c) Fabien Potencier <fabien@symfony.com> |
|
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 Symfony\Bridge\Monolog; |
|
13 |
|
14 use Monolog\Logger as BaseLogger; |
|
15 use Symfony\Component\HttpKernel\Log\LoggerInterface; |
|
16 use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; |
|
17 |
|
18 /** |
|
19 * Logger. |
|
20 * |
|
21 * @author Fabien Potencier <fabien@symfony.com> |
|
22 */ |
|
23 class Logger extends BaseLogger implements LoggerInterface, DebugLoggerInterface |
|
24 { |
|
25 /** |
|
26 * @see Symfony\Component\HttpKernel\Log\DebugLoggerInterface |
|
27 */ |
|
28 public function getLogs() |
|
29 { |
|
30 if ($logger = $this->getDebugLogger()) { |
|
31 return $logger->getLogs(); |
|
32 } |
|
33 } |
|
34 |
|
35 /** |
|
36 * @see Symfony\Component\HttpKernel\Log\DebugLoggerInterface |
|
37 */ |
|
38 public function countErrors() |
|
39 { |
|
40 if ($logger = $this->getDebugLogger()) { |
|
41 return $logger->countErrors(); |
|
42 } |
|
43 } |
|
44 |
|
45 /** |
|
46 * Returns a DebugLoggerInterface instance if one is registered with this logger. |
|
47 * |
|
48 * @return DebugLoggerInterface A DebugLoggerInterface instance or null if none is registered |
|
49 */ |
|
50 private function getDebugLogger() |
|
51 { |
|
52 foreach ($this->handlers as $handler) { |
|
53 if ($handler instanceof DebugLoggerInterface) { |
|
54 return $handler; |
|
55 } |
|
56 } |
|
57 } |
|
58 } |