Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Debug; Chris@0: Chris@0: use Psr\Log\AbstractLogger; Chris@0: Chris@0: /** Chris@0: * A buffering logger that stacks logs for later. Chris@0: * Chris@0: * @author Nicolas Grekas Chris@0: */ Chris@0: class BufferingLogger extends AbstractLogger Chris@0: { Chris@17: private $logs = []; Chris@0: Chris@17: public function log($level, $message, array $context = []) Chris@0: { Chris@17: $this->logs[] = [$level, $message, $context]; Chris@0: } Chris@0: Chris@0: public function cleanLogs() Chris@0: { Chris@0: $logs = $this->logs; Chris@17: $this->logs = []; Chris@0: Chris@0: return $logs; Chris@0: } Chris@0: }