ILogger.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  6. * SPDX-License-Identifier: AGPL-3.0-only
  7. */
  8. namespace OCP;
  9. /**
  10. * Interface ILogger
  11. * @since 7.0.0
  12. *
  13. * This logger interface follows the design guidelines of PSR-3
  14. * https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface
  15. * @deprecated 20.0.0 use the PSR-3 logger \Psr\Log\LoggerInterface
  16. */
  17. interface ILogger {
  18. /**
  19. * @since 14.0.0
  20. * @deprecated 20.0.0
  21. */
  22. public const DEBUG = 0;
  23. /**
  24. * @since 14.0.0
  25. * @deprecated 20.0.0
  26. */
  27. public const INFO = 1;
  28. /**
  29. * @since 14.0.0
  30. * @deprecated 20.0.0
  31. */
  32. public const WARN = 2;
  33. /**
  34. * @since 14.0.0
  35. * @deprecated 20.0.0
  36. */
  37. public const ERROR = 3;
  38. /**
  39. * @since 14.0.0
  40. * @deprecated 20.0.0
  41. */
  42. public const FATAL = 4;
  43. /**
  44. * System is unusable.
  45. *
  46. * @param string $message
  47. * @param array $context
  48. * @return null
  49. * @since 7.0.0
  50. * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::emergency
  51. */
  52. public function emergency(string $message, array $context = []);
  53. /**
  54. * Action must be taken immediately.
  55. *
  56. * @param string $message
  57. * @param array $context
  58. * @return null
  59. * @since 7.0.0
  60. * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::alert
  61. */
  62. public function alert(string $message, array $context = []);
  63. /**
  64. * Critical conditions.
  65. *
  66. * @param string $message
  67. * @param array $context
  68. * @return null
  69. * @since 7.0.0
  70. * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::critical
  71. */
  72. public function critical(string $message, array $context = []);
  73. /**
  74. * Runtime errors that do not require immediate action but should typically
  75. * be logged and monitored.
  76. *
  77. * @param string $message
  78. * @param array $context
  79. * @return null
  80. * @since 7.0.0
  81. * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::error
  82. */
  83. public function error(string $message, array $context = []);
  84. /**
  85. * Exceptional occurrences that are not errors.
  86. *
  87. * @param string $message
  88. * @param array $context
  89. * @return null
  90. * @since 7.0.0
  91. * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::warning
  92. */
  93. public function warning(string $message, array $context = []);
  94. /**
  95. * Normal but significant events.
  96. *
  97. * @param string $message
  98. * @param array $context
  99. * @return null
  100. * @since 7.0.0
  101. * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::notice
  102. */
  103. public function notice(string $message, array $context = []);
  104. /**
  105. * Interesting events.
  106. *
  107. * @param string $message
  108. * @param array $context
  109. * @return null
  110. * @since 7.0.0
  111. * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::info
  112. */
  113. public function info(string $message, array $context = []);
  114. /**
  115. * Detailed debug information.
  116. *
  117. * @param string $message
  118. * @param array $context
  119. * @return null
  120. * @since 7.0.0
  121. * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::debug
  122. */
  123. public function debug(string $message, array $context = []);
  124. /**
  125. * Logs with an arbitrary level.
  126. *
  127. * @param int $level
  128. * @param string $message
  129. * @param array $context
  130. * @return mixed
  131. * @since 7.0.0
  132. * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::log
  133. */
  134. public function log(int $level, string $message, array $context = []);
  135. /**
  136. * Logs an exception very detailed
  137. * An additional message can we written to the log by adding it to the
  138. * context.
  139. *
  140. * <code>
  141. * $logger->logException($ex, [
  142. * 'message' => 'Exception during background job execution'
  143. * ]);
  144. * </code>
  145. *
  146. * @param \Exception|\Throwable $exception
  147. * @param array $context
  148. * @return void
  149. * @since 8.2.0
  150. * @deprecated 20.0.0 use the `exception` entry in the context of any method in \Psr\Log\LoggerInterface
  151. */
  152. public function logException(\Throwable $exception, array $context = []);
  153. }