1
0

BeforeMessageLoggedEvent.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Log;
  8. use OCP\EventDispatcher\Event;
  9. /**
  10. * Even for when a log item is being logged
  11. *
  12. * @since 28.0.0
  13. */
  14. class BeforeMessageLoggedEvent extends Event {
  15. private int $level;
  16. private string $app;
  17. private $message;
  18. /**
  19. * @param string $app
  20. * @param int $level
  21. * @param array $message
  22. * @since 28.0.0
  23. */
  24. public function __construct(string $app, int $level, array $message) {
  25. $this->level = $level;
  26. $this->app = $app;
  27. $this->message = $message;
  28. }
  29. /**
  30. * Get the level of the log item
  31. *
  32. * @return int
  33. * @since 28.0.0
  34. */
  35. public function getLevel(): int {
  36. return $this->level;
  37. }
  38. /**
  39. * Get the app context of the log item
  40. *
  41. * @return string
  42. * @since 28.0.0
  43. */
  44. public function getApp(): string {
  45. return $this->app;
  46. }
  47. /**
  48. * Get the message of the log item
  49. *
  50. * @return array
  51. * @since 28.0.0
  52. */
  53. public function getMessage(): array {
  54. return $this->message;
  55. }
  56. }