Debugger.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Symfony\Bundle\FrameworkBundle\Templating;
  3. use Symfony\Components\Templating\DebuggerInterface;
  4. use Symfony\Components\HttpKernel\Log\LoggerInterface;
  5. /*
  6. * This file is part of the Symfony package.
  7. *
  8. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  9. *
  10. * For the full copyright and license information, please view the LICENSE
  11. * file that was distributed with this source code.
  12. */
  13. /**
  14. * Binds the Symfony templating loader debugger to the Symfony logger.
  15. *
  16. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  17. */
  18. class Debugger implements DebuggerInterface
  19. {
  20. protected $logger;
  21. /**
  22. * Constructor.
  23. *
  24. * @param LoggerInterface $logger A LoggerInterface instance
  25. */
  26. public function __construct(LoggerInterface $logger = null)
  27. {
  28. $this->logger = $logger;
  29. }
  30. /**
  31. * Logs a message.
  32. *
  33. * @param string $message A message to log
  34. */
  35. public function log($message)
  36. {
  37. if (null !== $this->logger) {
  38. $this->logger->info($message);
  39. }
  40. }
  41. }