1 | <?php |
||
17 | class Logger |
||
18 | { |
||
19 | /** |
||
20 | * @var resource |
||
21 | */ |
||
22 | private $infoHandle; |
||
23 | |||
24 | /** |
||
25 | * @var resource |
||
26 | */ |
||
27 | private $warnHandle; |
||
28 | |||
29 | /** |
||
30 | * @var resource |
||
31 | */ |
||
32 | private $errorHandle; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private static $remoteIp; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | private static $script; |
||
43 | |||
44 | /** |
||
45 | * @param string $remoteIp |
||
46 | * @param string $script |
||
47 | */ |
||
48 | public static function setup($remoteIp, $script) |
||
53 | |||
54 | /** |
||
55 | * Logger constructor. |
||
56 | * @param Contracts\Streamable $infoHandle |
||
57 | * @param Contracts\Streamable $warnHandle |
||
58 | * @param Contracts\Streamable $errorHandle |
||
59 | */ |
||
60 | public function __construct( |
||
69 | |||
70 | /** |
||
71 | * @throws \RuntimeException If something went wrong on creating the log dir and file. |
||
72 | */ |
||
73 | public function init() |
||
86 | |||
87 | /** |
||
88 | * @param string $msg |
||
89 | * |
||
90 | * @return Logger |
||
91 | */ |
||
92 | public function debug($msg) |
||
100 | |||
101 | /** |
||
102 | * @param string $msg |
||
103 | * |
||
104 | * @return Logger |
||
105 | */ |
||
106 | public function warn($msg) |
||
114 | |||
115 | /** |
||
116 | * @param string $msg |
||
117 | * |
||
118 | * @return Logger |
||
119 | */ |
||
120 | public function error($msg) |
||
126 | |||
127 | /** |
||
128 | * @param string $msg |
||
129 | * |
||
130 | * @return Logger |
||
131 | */ |
||
132 | public function info($msg) |
||
140 | |||
141 | /** |
||
142 | * @param string $msg |
||
143 | * @param string $severity |
||
144 | */ |
||
145 | protected function write($msg, $severity = 'DEBUG') |
||
158 | |||
159 | public function __destruct() |
||
174 | |||
175 | /** |
||
176 | * Formats the error message in representable manner. |
||
177 | * |
||
178 | * @param string $message |
||
179 | * @param string $severity |
||
180 | * |
||
181 | * @return string |
||
182 | */ |
||
183 | private function format($message, $severity) |
||
208 | |||
209 | /** |
||
210 | * @param string $varname |
||
211 | * |
||
212 | * @return bool |
||
213 | */ |
||
214 | protected function iniGetBool($varname) |
||
230 | } |
||
231 |