1 | <?php |
||
11 | class CLogger |
||
12 | { |
||
|
|||
13 | /** |
||
14 | * output directory |
||
15 | */ |
||
16 | private static $outputDir = __DIR__ . DIRECTORY_SEPARATOR; |
||
17 | |||
18 | /** |
||
19 | * Initializes class |
||
20 | */ |
||
21 | 1 | public static function init() |
|
22 | { |
||
23 | 1 | if (!file_exists(self::getOutput())) |
|
24 | { |
||
25 | mkdir(self::getOutput()); |
||
26 | } |
||
27 | |||
28 | 1 | set_error_handler([self::class, "writeErrors"]); |
|
29 | 1 | } |
|
30 | |||
31 | /** |
||
32 | * Sets output directory |
||
33 | * |
||
34 | */ |
||
35 | public static function setOutputDir($dir) |
||
39 | |||
40 | /** |
||
41 | * Returns output directory |
||
42 | */ |
||
43 | 1 | public static function getOutput() |
|
47 | |||
48 | /** |
||
49 | * Writes error to file. |
||
50 | * |
||
51 | * @param $errno int - error level |
||
52 | * @param $errstr string - error message |
||
53 | * @param $errfile string - filename of error causing file |
||
54 | * @param $errline int - line number of error |
||
55 | * |
||
56 | * @return bool |
||
57 | */ |
||
58 | 1 | public static function writeErrors($errno, $errstr, $errfile, $errline) |
|
66 | |||
67 | /** |
||
68 | * Converts errordata to array |
||
69 | * |
||
70 | * @param $errno int - error level |
||
71 | * @param $errstr string - error message |
||
72 | * @param $errfile string - filename of error causing file |
||
73 | * @param $errline int - line number of error |
||
74 | * |
||
75 | * @return array |
||
76 | */ |
||
77 | 1 | private static function getContents($errno, $errstr, $errfile, $errline) |
|
102 | } |
||
103 |