LoggingFormatter.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Symfony\Component\DependencyInjection\Compiler;
  3. use Symfony\Component\DependencyInjection\Definition;
  4. /**
  5. * Used to format logging messages during the compilation.
  6. *
  7. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  8. */
  9. class LoggingFormatter
  10. {
  11. public function formatRemoveService(CompilerPassInterface $pass, $id, $reason)
  12. {
  13. return $this->format($pass, sprintf('Removed service "%s"; reason: %s', $id, $reason));
  14. }
  15. public function formatInlineService(CompilerPassInterface $pass, $id, $target)
  16. {
  17. return $this->format($pass, sprintf('Inlined service "%s" to "%s".', $id, $target));
  18. }
  19. public function formatUpdateReference(CompilerPassInterface $pass, $serviceId, $oldDestId, $newDestId)
  20. {
  21. return $this->format($pass, sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $serviceId, $oldDestId, $newDestId));
  22. }
  23. public function formatResolveInheritance(CompilerPassInterface $pass, $childId, $parentId)
  24. {
  25. return $this->format($pass, sprintf('Resolving inheritance for "%s" (parent: %s).', $childId, $parentId));
  26. }
  27. public function format(CompilerPassInterface $pass, $message)
  28. {
  29. return sprintf('%s: %s', get_class($pass), $message);
  30. }
  31. }