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