10119ca25SAndreas Gohr<?php 20119ca25SAndreas Gohr 30119ca25SAndreas Gohrnamespace Psr\Log; 40119ca25SAndreas Gohr 50119ca25SAndreas Gohr/** 60119ca25SAndreas Gohr * Describes a logger instance. 70119ca25SAndreas Gohr * 80119ca25SAndreas Gohr * The message MUST be a string or object implementing __toString(). 90119ca25SAndreas Gohr * 100119ca25SAndreas Gohr * The message MAY contain placeholders in the form: {foo} where foo 110119ca25SAndreas Gohr * will be replaced by the context data in key "foo". 120119ca25SAndreas Gohr * 130119ca25SAndreas Gohr * The context array can contain arbitrary data. The only assumption that 140119ca25SAndreas Gohr * can be made by implementors is that if an Exception instance is given 150119ca25SAndreas Gohr * to produce a stack trace, it MUST be in a key named "exception". 160119ca25SAndreas Gohr * 170119ca25SAndreas Gohr * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md 180119ca25SAndreas Gohr * for the full interface specification. 190119ca25SAndreas Gohr */ 200119ca25SAndreas Gohrinterface LoggerInterface 210119ca25SAndreas Gohr{ 220119ca25SAndreas Gohr /** 230119ca25SAndreas Gohr * System is unusable. 240119ca25SAndreas Gohr * 250119ca25SAndreas Gohr * @param string $message 26*dc4d9dc6SAnna Dabrowska * @param mixed[] $context 270119ca25SAndreas Gohr * 280119ca25SAndreas Gohr * @return void 290119ca25SAndreas Gohr */ 300119ca25SAndreas Gohr public function emergency($message, array $context = array()); 310119ca25SAndreas Gohr 320119ca25SAndreas Gohr /** 330119ca25SAndreas Gohr * Action must be taken immediately. 340119ca25SAndreas Gohr * 350119ca25SAndreas Gohr * Example: Entire website down, database unavailable, etc. This should 360119ca25SAndreas Gohr * trigger the SMS alerts and wake you up. 370119ca25SAndreas Gohr * 380119ca25SAndreas Gohr * @param string $message 39*dc4d9dc6SAnna Dabrowska * @param mixed[] $context 400119ca25SAndreas Gohr * 410119ca25SAndreas Gohr * @return void 420119ca25SAndreas Gohr */ 430119ca25SAndreas Gohr public function alert($message, array $context = array()); 440119ca25SAndreas Gohr 450119ca25SAndreas Gohr /** 460119ca25SAndreas Gohr * Critical conditions. 470119ca25SAndreas Gohr * 480119ca25SAndreas Gohr * Example: Application component unavailable, unexpected exception. 490119ca25SAndreas Gohr * 500119ca25SAndreas Gohr * @param string $message 51*dc4d9dc6SAnna Dabrowska * @param mixed[] $context 520119ca25SAndreas Gohr * 530119ca25SAndreas Gohr * @return void 540119ca25SAndreas Gohr */ 550119ca25SAndreas Gohr public function critical($message, array $context = array()); 560119ca25SAndreas Gohr 570119ca25SAndreas Gohr /** 580119ca25SAndreas Gohr * Runtime errors that do not require immediate action but should typically 590119ca25SAndreas Gohr * be logged and monitored. 600119ca25SAndreas Gohr * 610119ca25SAndreas Gohr * @param string $message 62*dc4d9dc6SAnna Dabrowska * @param mixed[] $context 630119ca25SAndreas Gohr * 640119ca25SAndreas Gohr * @return void 650119ca25SAndreas Gohr */ 660119ca25SAndreas Gohr public function error($message, array $context = array()); 670119ca25SAndreas Gohr 680119ca25SAndreas Gohr /** 690119ca25SAndreas Gohr * Exceptional occurrences that are not errors. 700119ca25SAndreas Gohr * 710119ca25SAndreas Gohr * Example: Use of deprecated APIs, poor use of an API, undesirable things 720119ca25SAndreas Gohr * that are not necessarily wrong. 730119ca25SAndreas Gohr * 740119ca25SAndreas Gohr * @param string $message 75*dc4d9dc6SAnna Dabrowska * @param mixed[] $context 760119ca25SAndreas Gohr * 770119ca25SAndreas Gohr * @return void 780119ca25SAndreas Gohr */ 790119ca25SAndreas Gohr public function warning($message, array $context = array()); 800119ca25SAndreas Gohr 810119ca25SAndreas Gohr /** 820119ca25SAndreas Gohr * Normal but significant events. 830119ca25SAndreas Gohr * 840119ca25SAndreas Gohr * @param string $message 85*dc4d9dc6SAnna Dabrowska * @param mixed[] $context 860119ca25SAndreas Gohr * 870119ca25SAndreas Gohr * @return void 880119ca25SAndreas Gohr */ 890119ca25SAndreas Gohr public function notice($message, array $context = array()); 900119ca25SAndreas Gohr 910119ca25SAndreas Gohr /** 920119ca25SAndreas Gohr * Interesting events. 930119ca25SAndreas Gohr * 940119ca25SAndreas Gohr * Example: User logs in, SQL logs. 950119ca25SAndreas Gohr * 960119ca25SAndreas Gohr * @param string $message 97*dc4d9dc6SAnna Dabrowska * @param mixed[] $context 980119ca25SAndreas Gohr * 990119ca25SAndreas Gohr * @return void 1000119ca25SAndreas Gohr */ 1010119ca25SAndreas Gohr public function info($message, array $context = array()); 1020119ca25SAndreas Gohr 1030119ca25SAndreas Gohr /** 1040119ca25SAndreas Gohr * Detailed debug information. 1050119ca25SAndreas Gohr * 1060119ca25SAndreas Gohr * @param string $message 107*dc4d9dc6SAnna Dabrowska * @param mixed[] $context 1080119ca25SAndreas Gohr * 1090119ca25SAndreas Gohr * @return void 1100119ca25SAndreas Gohr */ 1110119ca25SAndreas Gohr public function debug($message, array $context = array()); 1120119ca25SAndreas Gohr 1130119ca25SAndreas Gohr /** 1140119ca25SAndreas Gohr * Logs with an arbitrary level. 1150119ca25SAndreas Gohr * 1160119ca25SAndreas Gohr * @param mixed $level 1170119ca25SAndreas Gohr * @param string $message 118*dc4d9dc6SAnna Dabrowska * @param mixed[] $context 1190119ca25SAndreas Gohr * 1200119ca25SAndreas Gohr * @return void 121*dc4d9dc6SAnna Dabrowska * 122*dc4d9dc6SAnna Dabrowska * @throws \Psr\Log\InvalidArgumentException 1230119ca25SAndreas Gohr */ 1240119ca25SAndreas Gohr public function log($level, $message, array $context = array()); 1250119ca25SAndreas Gohr} 126