Ei kuvausta

BufferingLogger.php 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Debug;
  11. use Psr\Log\AbstractLogger;
  12. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', BufferingLogger::class, \Symfony\Component\ErrorHandler\BufferingLogger::class), \E_USER_DEPRECATED);
  13. /**
  14. * A buffering logger that stacks logs for later.
  15. *
  16. * @author Nicolas Grekas <p@tchwork.com>
  17. *
  18. * @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\BufferingLogger instead.
  19. */
  20. class BufferingLogger extends AbstractLogger
  21. {
  22. private $logs = [];
  23. /**
  24. * @return void
  25. */
  26. public function log($level, $message, array $context = [])
  27. {
  28. $this->logs[] = [$level, $message, $context];
  29. }
  30. public function cleanLogs()
  31. {
  32. $logs = $this->logs;
  33. $this->logs = [];
  34. return $logs;
  35. }
  36. }