LoggerInterface.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. * @return null
  26. */
  27. public function emergency($message, array $context = array());
  28. /**
  29. * Action must be taken immediately.
  30. *
  31. * Example: Entire website down, database unavailable, etc. This should
  32. * trigger the SMS alerts and wake you up.
  33. *
  34. * @param string $message
  35. * @param array $context
  36. * @return null
  37. */
  38. public function alert($message, array $context = array());
  39. /**
  40. * Critical conditions.
  41. *
  42. * Example: Application component unavailable, unexpected exception.
  43. *
  44. * @param string $message
  45. * @param array $context
  46. * @return null
  47. */
  48. public function critical($message, array $context = array());
  49. /**
  50. * Runtime errors that do not require immediate action but should typically
  51. * be logged and monitored.
  52. *
  53. * @param string $message
  54. * @param array $context
  55. * @return null
  56. */
  57. public function error($message, array $context = array());
  58. /**
  59. * Exceptional occurrences that are not errors.
  60. *
  61. * Example: Use of deprecated APIs, poor use of an API, undesirable things
  62. * that are not necessarily wrong.
  63. *
  64. * @param string $message
  65. * @param array $context
  66. * @return null
  67. */
  68. public function warning($message, array $context = array());
  69. /**
  70. * Normal but significant events.
  71. *
  72. * @param string $message
  73. * @param array $context
  74. * @return null
  75. */
  76. public function notice($message, array $context = array());
  77. /**
  78. * Interesting events.
  79. *
  80. * Example: User logs in, SQL logs.
  81. *
  82. * @param string $message
  83. * @param array $context
  84. * @return null
  85. */
  86. public function info($message, array $context = array());
  87. /**
  88. * Detailed debug information.
  89. *
  90. * @param string $message
  91. * @param array $context
  92. * @return null
  93. */
  94. public function debug($message, array $context = array());
  95. /**
  96. * Logs with an arbitrary level.
  97. *
  98. * @param mixed $level
  99. * @param string $message
  100. * @param array $context
  101. * @return null
  102. */
  103. public function log($level, $message, array $context = array());
  104. }