IRegistry.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  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\Support\CrashReport;
  23. use Exception;
  24. use Throwable;
  25. /**
  26. * @since 13.0.0
  27. */
  28. interface IRegistry {
  29. /**
  30. * Register a reporter instance
  31. *
  32. * @param IReporter $reporter
  33. *
  34. * @since 13.0.0
  35. */
  36. public function register(IReporter $reporter): void;
  37. /**
  38. * Delegate breadcrumb collection to all registered reporters
  39. *
  40. * @param string $message
  41. * @param string $category
  42. * @param array $context
  43. *
  44. * @since 15.0.0
  45. */
  46. public function delegateBreadcrumb(string $message, string $category, array $context = []): void;
  47. /**
  48. * Delegate crash reporting to all registered reporters
  49. *
  50. * @param Exception|Throwable $exception
  51. * @param array $context
  52. *
  53. * @since 13.0.0
  54. */
  55. public function delegateReport($exception, array $context = []);
  56. /**
  57. * Delegate a message to all reporters that implement IMessageReporter
  58. *
  59. * @param string $message
  60. * @param array $context
  61. *
  62. * @return void
  63. *
  64. * @since 17.0.0
  65. */
  66. public function delegateMessage(string $message, array $context = []): void;
  67. }