LogMessageParserInterface.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. * - PSR3 format:
  13. * @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#12-message
  14. * - Drupal specific string placeholder format:
  15. * @see \Drupal\Component\Utility\SafeMarkup::format()
  16. *
  17. * Values in PSR3 format will be transformed to SafeMarkup::format() 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\Utility\SafeMarkup::format() 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. public function parseMessagePlaceholders(&$message, array &$context);
  30. }