IEventLogger.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP\Diagnostics;
  8. /**
  9. * Interface IEventLogger
  10. *
  11. * @since 8.0.0
  12. */
  13. interface IEventLogger {
  14. /**
  15. * Mark the start of an event setting its ID $id and providing event description $description.
  16. *
  17. * @param string $id
  18. * @param string $description
  19. * @since 8.0.0
  20. */
  21. public function start($id, $description);
  22. /**
  23. * Mark the end of an event with specific ID $id, marked by start() method.
  24. * Ending event should store \OCP\Diagnostics\IEvent to
  25. * be returned with getEvents() method.
  26. *
  27. * @param string $id
  28. * @since 8.0.0
  29. */
  30. public function end($id);
  31. /**
  32. * Mark the start and the end of an event with specific ID $id and description $description,
  33. * explicitly marking start and end of the event, represented by $start and $end timestamps.
  34. * Logging event should store \OCP\Diagnostics\IEvent to
  35. * be returned with getEvents() method.
  36. *
  37. * @param string $id
  38. * @param string $description
  39. * @param float $start
  40. * @param float $end
  41. * @since 8.0.0
  42. */
  43. public function log($id, $description, $start, $end);
  44. /**
  45. * This method should return all \OCP\Diagnostics\IEvent objects stored using
  46. * start()/end() or log() methods
  47. *
  48. * @return \OCP\Diagnostics\IEvent[]
  49. * @since 8.0.0
  50. */
  51. public function getEvents();
  52. /**
  53. * Activate the module for the duration of the request. Deactivated module
  54. * does not create and store \OCP\Diagnostics\IEvent objects.
  55. * Only activated module should create and store objects to be
  56. * returned with getEvents() call.
  57. *
  58. * @since 12.0.0
  59. */
  60. public function activate();
  61. }