6 * This is a simple Logger trait that classes unable to extend AbstractLogger
7 * (because they extend another class, etc) can include.
9 * It simply delegates all log-level-specific methods to the `log` method to
10 * reduce boilerplate code that a simple Logger that does the same thing with
11 * messages regardless of the error level has to implement.
18 * @param string $message
19 * @param array $context
23 public function emergency($message, array $context = array())
25 $this->log(LogLevel::EMERGENCY, $message, $context);
29 * Action must be taken immediately.
31 * Example: Entire website down, database unavailable, etc. This should
32 * trigger the SMS alerts and wake you up.
34 * @param string $message
35 * @param array $context
39 public function alert($message, array $context = array())
41 $this->log(LogLevel::ALERT, $message, $context);
45 * Critical conditions.
47 * Example: Application component unavailable, unexpected exception.
49 * @param string $message
50 * @param array $context
54 public function critical($message, array $context = array())
56 $this->log(LogLevel::CRITICAL, $message, $context);
60 * Runtime errors that do not require immediate action but should typically
61 * be logged and monitored.
63 * @param string $message
64 * @param array $context
68 public function error($message, array $context = array())
70 $this->log(LogLevel::ERROR, $message, $context);
74 * Exceptional occurrences that are not errors.
76 * Example: Use of deprecated APIs, poor use of an API, undesirable things
77 * that are not necessarily wrong.
79 * @param string $message
80 * @param array $context
84 public function warning($message, array $context = array())
86 $this->log(LogLevel::WARNING, $message, $context);
90 * Normal but significant events.
92 * @param string $message
93 * @param array $context
97 public function notice($message, array $context = array())
99 $this->log(LogLevel::NOTICE, $message, $context);
103 * Interesting events.
105 * Example: User logs in, SQL logs.
107 * @param string $message
108 * @param array $context
112 public function info($message, array $context = array())
114 $this->log(LogLevel::INFO, $message, $context);
118 * Detailed debug information.
120 * @param string $message
121 * @param array $context
125 public function debug($message, array $context = array())
127 $this->log(LogLevel::DEBUG, $message, $context);
131 * Logs with an arbitrary level.
133 * @param mixed $level
134 * @param string $message
135 * @param array $context
139 abstract public function log($level, $message, array $context = array());