1 | <?php namespace Arcanedev\Stripe\Utilities; |
||
11 | class DefaultLogger implements LoggerInterface |
||
12 | { |
||
13 | /* ----------------------------------------------------------------- |
||
14 | | Main Methods |
||
15 | | ----------------------------------------------------------------- |
||
16 | */ |
||
17 | |||
18 | /** |
||
19 | * System is unusable. |
||
20 | * |
||
21 | * @param string $message |
||
22 | * @param array $context |
||
23 | */ |
||
24 | public function emergency($message, array $context = []) |
||
28 | |||
29 | /** |
||
30 | * Action must be taken immediately. |
||
31 | * |
||
32 | * Example: Entire website down, database unavailable, etc. This should |
||
33 | * trigger the SMS alerts and wake you up. |
||
34 | * |
||
35 | * @param string $message |
||
36 | * @param array $context |
||
37 | */ |
||
38 | public function alert($message, array $context = []) |
||
42 | |||
43 | /** |
||
44 | * Critical conditions. |
||
45 | * |
||
46 | * Example: Application component unavailable, unexpected exception. |
||
47 | * |
||
48 | * @param string $message |
||
49 | * @param array $context |
||
50 | */ |
||
51 | public function critical($message, array $context = []) |
||
55 | |||
56 | /** |
||
57 | * Runtime errors that do not require immediate action but should typically |
||
58 | * be logged and monitored. |
||
59 | * |
||
60 | * @param string $message |
||
61 | * @param array $context |
||
62 | */ |
||
63 | 2 | public function error($message, array $context = []) |
|
64 | { |
||
65 | 2 | if (count($context) > 0) { |
|
66 | throw new \Exception( |
||
67 | 'DefaultLogger does not currently implement context. Please implement if you need it.' |
||
68 | ); |
||
69 | } |
||
70 | |||
71 | 2 | error_log($message); |
|
72 | 2 | } |
|
73 | |||
74 | /** |
||
75 | * Exceptional occurrences that are not errors. |
||
76 | * |
||
77 | * Example: Use of deprecated APIs, poor use of an API, undesirable things |
||
78 | * that are not necessarily wrong. |
||
79 | * |
||
80 | * @param string $message |
||
81 | * @param array $context |
||
82 | */ |
||
83 | public function warning($message, array $context = []) |
||
87 | |||
88 | /** |
||
89 | * Normal but significant events. |
||
90 | * |
||
91 | * @param string $message |
||
92 | * @param array $context |
||
93 | */ |
||
94 | public function notice($message, array $context = array()) |
||
98 | |||
99 | /** |
||
100 | * Interesting events. |
||
101 | * |
||
102 | * Example: User logs in, SQL logs. |
||
103 | * |
||
104 | * @param string $message |
||
105 | * @param array $context |
||
106 | */ |
||
107 | public function info($message, array $context = []) |
||
111 | |||
112 | /** |
||
113 | * Detailed debug information. |
||
114 | * |
||
115 | * @param string $message |
||
116 | * @param array $context |
||
117 | */ |
||
118 | public function debug($message, array $context = []) |
||
122 | |||
123 | /** |
||
124 | * Logs with an arbitrary level. |
||
125 | * |
||
126 | * @param mixed $level |
||
127 | * @param string $message |
||
128 | * @param array $context |
||
129 | */ |
||
130 | public function log($level, $message, array $context = []) |
||
134 | } |
||
135 |