ILogger.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Thomas Müller <thomas.mueller@tmit.eu>
  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;
  25. /**
  26. * Interface ILogger
  27. * @package OCP
  28. * @since 7.0.0
  29. *
  30. * This logger interface follows the design guidelines of PSR-3
  31. * https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface
  32. */
  33. interface ILogger {
  34. /**
  35. * System is unusable.
  36. *
  37. * @param string $message
  38. * @param array $context
  39. * @return null
  40. * @since 7.0.0
  41. */
  42. public function emergency($message, array $context = array());
  43. /**
  44. * Action must be taken immediately.
  45. *
  46. * @param string $message
  47. * @param array $context
  48. * @return null
  49. * @since 7.0.0
  50. */
  51. public function alert($message, array $context = array());
  52. /**
  53. * Critical conditions.
  54. *
  55. * @param string $message
  56. * @param array $context
  57. * @return null
  58. * @since 7.0.0
  59. */
  60. public function critical($message, array $context = array());
  61. /**
  62. * Runtime errors that do not require immediate action but should typically
  63. * be logged and monitored.
  64. *
  65. * @param string $message
  66. * @param array $context
  67. * @return null
  68. * @since 7.0.0
  69. */
  70. public function error($message, array $context = array());
  71. /**
  72. * Exceptional occurrences that are not errors.
  73. *
  74. * @param string $message
  75. * @param array $context
  76. * @return null
  77. * @since 7.0.0
  78. */
  79. public function warning($message, array $context = array());
  80. /**
  81. * Normal but significant events.
  82. *
  83. * @param string $message
  84. * @param array $context
  85. * @return null
  86. * @since 7.0.0
  87. */
  88. public function notice($message, array $context = array());
  89. /**
  90. * Interesting events.
  91. *
  92. * @param string $message
  93. * @param array $context
  94. * @return null
  95. * @since 7.0.0
  96. */
  97. public function info($message, array $context = array());
  98. /**
  99. * Detailed debug information.
  100. *
  101. * @param string $message
  102. * @param array $context
  103. * @return null
  104. * @since 7.0.0
  105. */
  106. public function debug($message, array $context = array());
  107. /**
  108. * Logs with an arbitrary level.
  109. *
  110. * @param mixed $level
  111. * @param string $message
  112. * @param array $context
  113. * @return mixed
  114. * @since 7.0.0
  115. */
  116. public function log($level, $message, array $context = array());
  117. /**
  118. * Logs an exception very detailed
  119. * An additional message can we written to the log by adding it to the
  120. * context.
  121. *
  122. * <code>
  123. * $logger->logException($ex, [
  124. * 'message' => 'Exception during background job execution'
  125. * ]);
  126. * </code>
  127. *
  128. * @param \Exception | \Throwable $exception
  129. * @param array $context
  130. * @return void
  131. * @since 8.2.0
  132. */
  133. public function logException($exception, array $context = array());
  134. }