| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 46 | public static function log(string $text = ''): void |
||
| 47 | { |
||
| 48 | $dir = BOOTSTRAP_DIR . '/../tmp/shieldon/session_logs'; |
||
| 49 | $file = $dir . '/' . date('Y-m-d') . '.json'; |
||
| 50 | |||
| 51 | $originalUmask = umask(0); |
||
| 52 | |||
| 53 | if (!is_dir($dir)) { |
||
| 54 | mkdir($dir, 0777, true); |
||
| 55 | } |
||
| 56 | |||
| 57 | umask($originalUmask); |
||
| 58 | |||
| 59 | $method = debug_backtrace()[1]['function']; |
||
| 60 | |||
| 61 | $content = date('Y-m-d H:i:s') . ' - [' . $method . '] ' . $text; |
||
| 62 | |||
| 63 | file_put_contents($file, $content . PHP_EOL, FILE_APPEND); |
||
| 64 | } |
||
| 66 |