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