Conditions | 4 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
16 | function errorLog(\Throwable $exception) |
||
17 | { |
||
18 | if (getenv('BLUZ_LOG') && is_dir(PATH_DATA . '/logs') && is_writable(PATH_DATA . '/logs')) { |
||
19 | // [Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1] client denied by server configuration: /var/www/... |
||
20 | $message = '[' . date('r') . '] [' . get_class($exception) . '] ' |
||
21 | . '[' . $_SERVER['REQUEST_URI'] . ']' |
||
22 | . $exception->getFile() . ':' . $exception->getLine() |
||
23 | . ': ' |
||
24 | . trim($exception->getMessage()) |
||
25 | . "\n"; |
||
26 | |||
27 | // write log |
||
28 | file_put_contents( |
||
29 | PATH_DATA . '/logs/' . date('Y-m-d') . '.log', |
||
30 | $message, |
||
31 | FILE_APPEND | LOCK_EX |
||
32 | ); |
||
35 |