IEventLogger.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. * @package OCP\Diagnostics
  29. * @since 8.0.0
  30. */
  31. interface IEventLogger {
  32. /**
  33. * Mark the start of an event setting its ID $id and providing event description $description.
  34. *
  35. * @param string $id
  36. * @param string $description
  37. * @since 8.0.0
  38. */
  39. public function start($id, $description);
  40. /**
  41. * Mark the end of an event with specific ID $id, marked by start() method.
  42. * Ending event should store \OCP\Diagnostics\IEvent to
  43. * be returned with getEvents() method.
  44. *
  45. * @param string $id
  46. * @since 8.0.0
  47. */
  48. public function end($id);
  49. /**
  50. * Mark the start and the end of an event with specific ID $id and description $description,
  51. * explicitly marking start and end of the event, represented by $start and $end timestamps.
  52. * Logging event should store \OCP\Diagnostics\IEvent to
  53. * be returned with getEvents() method.
  54. *
  55. * @param string $id
  56. * @param string $description
  57. * @param float $start
  58. * @param float $end
  59. * @since 8.0.0
  60. */
  61. public function log($id, $description, $start, $end);
  62. /**
  63. * This method should return all \OCP\Diagnostics\IEvent objects stored using
  64. * start()/end() or log() methods
  65. *
  66. * @return \OCP\Diagnostics\IEvent[]
  67. * @since 8.0.0
  68. */
  69. public function getEvents();
  70. /**
  71. * Activate the module for the duration of the request. Deactivated module
  72. * does not create and store \OCP\Diagnostics\IEvent objects.
  73. * Only activated module should create and store objects to be
  74. * returned with getEvents() call.
  75. *
  76. * @since 12.0.0
  77. */
  78. public function activate();
  79. }