1 | <?php |
||
9 | class LogDispatcher implements LoggerInterface |
||
10 | { |
||
11 | private $log; |
||
12 | |||
13 | public function __construct($path) |
||
18 | |||
19 | /** |
||
20 | * @return Logger |
||
21 | */ |
||
22 | public function getLog() |
||
26 | |||
27 | /** |
||
28 | * System is unusable. |
||
29 | * |
||
30 | * @param string $message |
||
31 | * @param array $context |
||
32 | * |
||
33 | * @return null |
||
34 | */ |
||
35 | public function emergency($message, array $context = array()) |
||
39 | |||
40 | /** |
||
41 | * Action must be taken immediately. |
||
42 | * |
||
43 | * Example: Entire website down, database unavailable, etc. This should |
||
44 | * trigger the SMS alerts and wake you up. |
||
45 | * |
||
46 | * @param string $message |
||
47 | * @param array $context |
||
48 | * |
||
49 | * @return null |
||
50 | */ |
||
51 | public function alert($message, array $context = array()) |
||
55 | |||
56 | /** |
||
57 | * Critical conditions. |
||
58 | * |
||
59 | * Example: Application component unavailable, unexpected exception. |
||
60 | * |
||
61 | * @param string $message |
||
62 | * @param array $context |
||
63 | * |
||
64 | * @return null |
||
65 | */ |
||
66 | public function critical($message, array $context = array()) |
||
70 | |||
71 | /** |
||
72 | * Runtime errors that do not require immediate action but should typically |
||
73 | * be logged and monitored. |
||
74 | * |
||
75 | * @param string $message |
||
76 | * @param array $context |
||
77 | * |
||
78 | * @return null |
||
79 | */ |
||
80 | public function error($message, array $context = array()) |
||
84 | |||
85 | /** |
||
86 | * Exceptional occurrences that are not errors. |
||
87 | * |
||
88 | * Example: Use of deprecated APIs, poor use of an API, undesirable things |
||
89 | * that are not necessarily wrong. |
||
90 | * |
||
91 | * @param string $message |
||
92 | * @param array $context |
||
93 | * |
||
94 | * @return null |
||
95 | */ |
||
96 | public function warning($message, array $context = array()) |
||
100 | |||
101 | /** |
||
102 | * Normal but significant events. |
||
103 | * |
||
104 | * @param string $message |
||
105 | * @param array $context |
||
106 | * |
||
107 | * @return null |
||
108 | */ |
||
109 | public function notice($message, array $context = array()) |
||
113 | |||
114 | /** |
||
115 | * Interesting events. |
||
116 | * |
||
117 | * Example: User logs in, SQL logs. |
||
118 | * |
||
119 | * @param string $message |
||
120 | * @param array $context |
||
121 | * |
||
122 | * @return null |
||
123 | */ |
||
124 | public function info($message, array $context = array()) |
||
128 | |||
129 | /** |
||
130 | * Detailed debug information. |
||
131 | * |
||
132 | * @param string $message |
||
133 | * @param array $context |
||
134 | * |
||
135 | * @return null |
||
136 | */ |
||
137 | public function debug($message, array $context = array()) |
||
141 | |||
142 | /** |
||
143 | * Logs with an arbitrary level. |
||
144 | * |
||
145 | * @param mixed $level |
||
146 | * @param string $message |
||
147 | * @param array $context |
||
148 | * |
||
149 | * @return null |
||
150 | */ |
||
151 | public function log($level, $message, array $context = array()) |
||
155 | } |