LoggerInterface.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. namespace Psr\Log;
  3. /**
  4. * Describes a logger instance.
  5. *
  6. * The message MUST be a string or object implementing __toString().
  7. *
  8. * The message MAY contain placeholders in the form: {foo} where foo
  9. * will be replaced by the context data in key "foo".
  10. *
  11. * The context array can contain arbitrary data. The only assumption that
  12. * can be made by implementors is that if an Exception instance is given
  13. * to produce a stack trace, it MUST be in a key named "exception".
  14. *
  15. * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
  16. * for the full interface specification.
  17. */
  18. interface LoggerInterface
  19. {
  20. /**
  21. * System is unusable.
  22. *
  23. * @param string $message
  24. * @param array $context
  25. *
  26. * @return void
  27. */
  28. public function emergency($message, array $context = array());
  29. /**
  30. * Action must be taken immediately.
  31. *
  32. * Example: Entire website down, database unavailable, etc. This should
  33. * trigger the SMS alerts and wake you up.
  34. *
  35. * @param string $message
  36. * @param array $context
  37. *
  38. * @return void
  39. */
  40. public function alert($message, array $context = array());
  41. /**
  42. * Critical conditions.
  43. *
  44. * Example: Application component unavailable, unexpected exception.
  45. *
  46. * @param string $message
  47. * @param array $context
  48. *
  49. * @return void
  50. */
  51. public function critical($message, array $context = array());
  52. /**
  53. * Runtime errors that do not require immediate action but should typically
  54. * be logged and monitored.
  55. *
  56. * @param string $message
  57. * @param array $context
  58. *
  59. * @return void
  60. */
  61. public function error($message, array $context = array());
  62. /**
  63. * Exceptional occurrences that are not errors.
  64. *
  65. * Example: Use of deprecated APIs, poor use of an API, undesirable things
  66. * that are not necessarily wrong.
  67. *
  68. * @param string $message
  69. * @param array $context
  70. *
  71. * @return void
  72. */
  73. public function warning($message, array $context = array());
  74. /**
  75. * Normal but significant events.
  76. *
  77. * @param string $message
  78. * @param array $context
  79. *
  80. * @return void
  81. */
  82. public function notice($message, array $context = array());
  83. /**
  84. * Interesting events.
  85. *
  86. * Example: User logs in, SQL logs.
  87. *
  88. * @param string $message
  89. * @param array $context
  90. *
  91. * @return void
  92. */
  93. public function info($message, array $context = array());
  94. /**
  95. * Detailed debug information.
  96. *
  97. * @param string $message
  98. * @param array $context
  99. *
  100. * @return void
  101. */
  102. public function debug($message, array $context = array());
  103. /**
  104. * Logs with an arbitrary level.
  105. *
  106. * @param mixed $level
  107. * @param string $message
  108. * @param array $context
  109. *
  110. * @return void
  111. */
  112. public function log($level, $message, array $context = array());
  113. }