Logger.php 3.3 KB

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