1
0

ILogger.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  6. * @author Jan-Christoph Borchardt <hey@jancborchardt.net>
  7. * @author Lukas Reschke <lukas@statuscode.ch>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCP;
  27. /**
  28. * Interface ILogger
  29. * @package OCP
  30. * @since 7.0.0
  31. *
  32. * This logger interface follows the design guidelines of PSR-3
  33. * https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface
  34. */
  35. interface ILogger {
  36. /**
  37. * System is unusable.
  38. *
  39. * @param string $message
  40. * @param array $context
  41. * @return null
  42. * @since 7.0.0
  43. */
  44. public function emergency($message, array $context = array());
  45. /**
  46. * Action must be taken immediately.
  47. *
  48. * @param string $message
  49. * @param array $context
  50. * @return null
  51. * @since 7.0.0
  52. */
  53. public function alert($message, array $context = array());
  54. /**
  55. * Critical conditions.
  56. *
  57. * @param string $message
  58. * @param array $context
  59. * @return null
  60. * @since 7.0.0
  61. */
  62. public function critical($message, array $context = array());
  63. /**
  64. * Runtime errors that do not require immediate action but should typically
  65. * be logged and monitored.
  66. *
  67. * @param string $message
  68. * @param array $context
  69. * @return null
  70. * @since 7.0.0
  71. */
  72. public function error($message, array $context = array());
  73. /**
  74. * Exceptional occurrences that are not errors.
  75. *
  76. * @param string $message
  77. * @param array $context
  78. * @return null
  79. * @since 7.0.0
  80. */
  81. public function warning($message, array $context = array());
  82. /**
  83. * Normal but significant events.
  84. *
  85. * @param string $message
  86. * @param array $context
  87. * @return null
  88. * @since 7.0.0
  89. */
  90. public function notice($message, array $context = array());
  91. /**
  92. * Interesting events.
  93. *
  94. * @param string $message
  95. * @param array $context
  96. * @return null
  97. * @since 7.0.0
  98. */
  99. public function info($message, array $context = array());
  100. /**
  101. * Detailed debug information.
  102. *
  103. * @param string $message
  104. * @param array $context
  105. * @return null
  106. * @since 7.0.0
  107. */
  108. public function debug($message, array $context = array());
  109. /**
  110. * Logs with an arbitrary level.
  111. *
  112. * @param mixed $level
  113. * @param string $message
  114. * @param array $context
  115. * @return mixed
  116. * @since 7.0.0
  117. */
  118. public function log($level, $message, array $context = array());
  119. /**
  120. * Logs an exception very detailed
  121. * An additional message can we written to the log by adding it to the
  122. * context.
  123. *
  124. * <code>
  125. * $logger->logException($ex, [
  126. * 'message' => 'Exception during background job execution'
  127. * ]);
  128. * </code>
  129. *
  130. * @param \Exception|\Throwable $exception
  131. * @param array $context
  132. * @return void
  133. * @since 8.2.0
  134. */
  135. public function logException($exception, array $context = array());
  136. }