LoggerInterface.php 2.8 KB

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