6
* This is a simple Logger implementation that other Loggers can inherit from.
8
* It simply delegates all log-level-specific methods to the `log` method to
9
* reduce boilerplate code that a simple Logger that does the same thing with
10
* messages regardless of the error level has to implement.
12
abstract class AbstractLogger implements LoggerInterface
17
* @param string $message
18
* @param array $context
21
public function emergency($message, array $context = array())
23
$this->log(LogLevel::EMERGENCY, $message, $context);
27
* Action must be taken immediately.
29
* Example: Entire website down, database unavailable, etc. This should
30
* trigger the SMS alerts and wake you up.
32
* @param string $message
33
* @param array $context
36
public function alert($message, array $context = array())
38
$this->log(LogLevel::ALERT, $message, $context);
42
* Critical conditions.
44
* Example: Application component unavailable, unexpected exception.
46
* @param string $message
47
* @param array $context
50
public function critical($message, array $context = array())
52
$this->log(LogLevel::CRITICAL, $message, $context);
56
* Runtime errors that do not require immediate action but should typically
57
* be logged and monitored.
59
* @param string $message
60
* @param array $context
63
public function error($message, array $context = array())
65
$this->log(LogLevel::ERROR, $message, $context);
69
* Exceptional occurrences that are not errors.
71
* Example: Use of deprecated APIs, poor use of an API, undesirable things
72
* that are not necessarily wrong.
74
* @param string $message
75
* @param array $context
78
public function warning($message, array $context = array())
80
$this->log(LogLevel::WARNING, $message, $context);
84
* Normal but significant events.
86
* @param string $message
87
* @param array $context
90
public function notice($message, array $context = array())
92
$this->log(LogLevel::NOTICE, $message, $context);
98
* Example: User logs in, SQL logs.
100
* @param string $message
101
* @param array $context
104
public function info($message, array $context = array())
106
$this->log(LogLevel::INFO, $message, $context);
110
* Detailed debug information.
112
* @param string $message
113
* @param array $context
116
public function debug($message, array $context = array())
118
$this->log(LogLevel::DEBUG, $message, $context);