1 | <?php |
||
5 | class Logger |
||
6 | { |
||
7 | protected static $instance = null; |
||
8 | |||
9 | /** |
||
10 | * This class is singleton, so that later we can move to DI patterns. |
||
11 | * |
||
12 | * @return Logger |
||
13 | */ |
||
14 | 20 | public static function instance() |
|
22 | |||
23 | /** |
||
24 | * Echoes a debug message, taking care of escaping it when not in console mode. |
||
25 | * NB: if the encoding of the message is not known or wrong, and we are working in web mode, there is no guarantee |
||
26 | * of 100% accuracy, which kind of defeats the purpose of debugging |
||
27 | * |
||
28 | * @param string $message |
||
29 | * @param string $encoding |
||
30 | */ |
||
31 | public function debugMessage($message, $encoding = null) |
||
59 | |||
60 | /** |
||
61 | * Writes a message to the error log |
||
62 | */ |
||
63 | 20 | public function errorLog($message) |
|
67 | } |
||
68 |