Settings.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 SCAN_BATCH_SIZE = 100;
  18. const ENTRIES_PER_PAGE = 50;
  19. /**
  20. * @return string[int]
  21. */
  22. public static function Levels() {
  23. return watchdog_severity_levels();
  24. }
  25. public static function getChannelRegex() {
  26. return static::CHANNEL_REGEX;
  27. }
  28. public static function getEntriesPerPage($requested = 0) {
  29. return $requested ?: static::ENTRIES_PER_PAGE;
  30. }
  31. public static function getPrefix() {
  32. return static::PREFIX;
  33. }
  34. public static function getRedisPattern() {
  35. return static::REDIS_PATTERN;
  36. }
  37. public static function getScanBatchSize() {
  38. return static::SCAN_BATCH_SIZE;
  39. }
  40. public static function getSeverityRegex() {
  41. return static::SEVERITY_REGEX;
  42. }
  43. }