You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.4 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Piotr Mrówczyński <mrow4a@yahoo.com>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OCP\Diagnostics;
  25. /**
  26. * Interface IEventLogger
  27. *
  28. * @since 8.0.0
  29. */
  30. interface IEventLogger {
  31. /**
  32. * Mark the start of an event setting its ID $id and providing event description $description.
  33. *
  34. * @param string $id
  35. * @param string $description
  36. * @since 8.0.0
  37. */
  38. public function start($id, $description);
  39. /**
  40. * Mark the end of an event with specific ID $id, marked by start() method.
  41. * Ending event should store \OCP\Diagnostics\IEvent to
  42. * be returned with getEvents() method.
  43. *
  44. * @param string $id
  45. * @since 8.0.0
  46. */
  47. public function end($id);
  48. /**
  49. * Mark the start and the end of an event with specific ID $id and description $description,
  50. * explicitly marking start and end of the event, represented by $start and $end timestamps.
  51. * Logging event should store \OCP\Diagnostics\IEvent to
  52. * be returned with getEvents() method.
  53. *
  54. * @param string $id
  55. * @param string $description
  56. * @param float $start
  57. * @param float $end
  58. * @since 8.0.0
  59. */
  60. public function log($id, $description, $start, $end);
  61. /**
  62. * This method should return all \OCP\Diagnostics\IEvent objects stored using
  63. * start()/end() or log() methods
  64. *
  65. * @return \OCP\Diagnostics\IEvent[]
  66. * @since 8.0.0
  67. */
  68. public function getEvents();
  69. /**
  70. * Activate the module for the duration of the request. Deactivated module
  71. * does not create and store \OCP\Diagnostics\IEvent objects.
  72. * Only activated module should create and store objects to be
  73. * returned with getEvents() call.
  74. *
  75. * @since 12.0.0
  76. */
  77. public function activate();
  78. }