LogMessageParserInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Drupal\Core\Logger;
  3. /**
  4. * Defines an interface for parsing log messages and their placeholders.
  5. */
  6. interface LogMessageParserInterface {
  7. /**
  8. * Parses and transforms message and its placeholders to a common format.
  9. *
  10. * For a value to be considered as a placeholder should be in the following
  11. * formats:
  12. * - @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#12-message The PSR3 format @endlink
  13. * - The Drupal specific string placeholder format, described in
  14. * \Drupal\Component\Render\FormattableMarkup
  15. *
  16. * Values in PSR3 format will be transformed to
  17. * \Drupal\Component\Render\FormattableMarkup format.
  18. *
  19. * @param string $message
  20. * The message that contains the placeholders.
  21. * If the message is in PSR3 style, it will be transformed to
  22. * \Drupal\Component\Render\FormattableMarkup style.
  23. * @param array $context
  24. * An array that may or may not contain placeholder variables.
  25. *
  26. * @return array
  27. * An array of the extracted message placeholders.
  28. *
  29. * @see \Drupal\Component\Render\FormattableMarkup
  30. */
  31. public function parseMessagePlaceholders(&$message, array &$context);
  32. }