1
0

BeforeMessageLoggedEvent.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2023 Robin Appelman <robin@icewind.nl>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. namespace OCP\Log;
  23. use OCP\EventDispatcher\Event;
  24. /**
  25. * Even for when a log item is being logged
  26. *
  27. * @since 28.0.0
  28. */
  29. class BeforeMessageLoggedEvent extends Event {
  30. private int $level;
  31. private string $app;
  32. private $message;
  33. /**
  34. * @param string $app
  35. * @param int $level
  36. * @param array $message
  37. * @since 28.0.0
  38. */
  39. public function __construct(string $app, int $level, array $message) {
  40. $this->level = $level;
  41. $this->app = $app;
  42. $this->message = $message;
  43. }
  44. /**
  45. * Get the level of the log item
  46. *
  47. * @return int
  48. * @since 28.0.0
  49. */
  50. public function getLevel(): int {
  51. return $this->level;
  52. }
  53. /**
  54. * Get the app context of the log item
  55. *
  56. * @return string
  57. * @since 28.0.0
  58. */
  59. public function getApp(): string {
  60. return $this->app;
  61. }
  62. /**
  63. * Get the message of the log item
  64. *
  65. * @return array
  66. * @since 28.0.0
  67. */
  68. public function getMessage(): array {
  69. return $this->message;
  70. }
  71. }