Settings.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * @file
  4. * Contains the Redis\Logger\Settings class.
  5. */
  6. namespace Redis\Logger;
  7. /**
  8. * Class Settings contains the default configuration for the Logger logic.
  9. *
  10. * @package Redis\Logger
  11. */
  12. class Settings {
  13. const PREFIX = "drupal:watchdog:";
  14. const REDIS_PATTERN = 'drupal:watchdog:*:[01234567]:*';
  15. const CHANNEL_REGEX = '/drupal:watchdog:([\w]+):[\d]:.*/';
  16. const SEVERITY_REGEX = '/drupal:watchdog:[\w]+:([\d]):.*/';
  17. const SPLITING_REGEX = '/drupal:watchdog:([\w]+):([\d]):(.*)/';
  18. const SCAN_BATCH_SIZE = 100;
  19. const ENTRIES_PER_PAGE = 50;
  20. /**
  21. * @return string[int]
  22. * The translated severity levels keys by WATCHDOG_* value.
  23. */
  24. public static function getSeverityLevels() {
  25. return watchdog_severity_levels();
  26. }
  27. public static function getChannelRegex() {
  28. return static::CHANNEL_REGEX;
  29. }
  30. public static function getEntriesPerPage($requested = 0) {
  31. return $requested ?: static::ENTRIES_PER_PAGE;
  32. }
  33. public static function getPrefix() {
  34. return static::PREFIX;
  35. }
  36. public static function getRedisPattern() {
  37. return static::REDIS_PATTERN;
  38. }
  39. public static function getScanBatchSize() {
  40. return static::SCAN_BATCH_SIZE;
  41. }
  42. public static function getSeverityRegex() {
  43. return static::SEVERITY_REGEX;
  44. }
  45. public static function getSplittingRegex() {
  46. return static::SPLITING_REGEX;
  47. }
  48. }