<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Monolog; use Monolog\Logger as BaseLogger; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; /** * Logger. * * @author Fabien Potencier <fabien@symfony.com> */ class Logger extends BaseLogger implements DebugLoggerInterface { /** * {@inheritdoc} */ public function getLogs() { if ($logger = $this->getDebugLogger()) { return $logger->getLogs(); } return []; } /** * {@inheritdoc} */ public function countErrors() { if ($logger = $this->getDebugLogger()) { return $logger->countErrors(); } return 0; } /** * {@inheritdoc} */ public function clear() { if (($logger = $this->getDebugLogger()) && method_exists($logger, 'clear')) { $logger->clear(); } } /** * Returns a DebugLoggerInterface instance if one is registered with this logger. * * @return DebugLoggerInterface|null A DebugLoggerInterface instance or null if none is registered */ private function getDebugLogger() { foreach ($this->processors as $processor) { if ($processor instanceof DebugLoggerInterface) { return $processor; } } foreach ($this->handlers as $handler) { if ($handler instanceof DebugLoggerInterface) { return $handler; } } return null; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Formatter | Folder | 0755 |
|
|
Handler | Folder | 0755 |
|
|
Processor | Folder | 0755 |
|
|
Tests | Folder | 0755 |
|
|
.gitignore | File | 34 B | 0644 |
|
CHANGELOG.md | File | 532 B | 0644 |
|
LICENSE | File | 1.04 KB | 0644 |
|
Logger.php | File | 1.7 KB | 0644 |
|
README.md | File | 402 B | 0644 |
|
composer.json | File | 1.58 KB | 0644 |
|
phpunit.xml.dist | File | 882 B | 0644 |
|