diff options
Diffstat (limited to 'App.php')
-rw-r--r-- | App.php | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -109,7 +109,9 @@ class App static function error($msg) { $err = array('result' => 'error', 'msg' => $msg); + // Send error to client self::json($msg); + // And log it locally self::log($msg); } @@ -121,16 +123,27 @@ class App if (is_array($msg)) { $msg = print_r($msg, true); } + $c = self::conf("app.error_log"); + + if (!$c) { + return false; + } + $file = realpath(__FILE__."/../../../../data/$c"); + if (!$file) { return false; } + $fh = fopen($file, "a+"); fwrite($fh, $msg); fclose($fh); } - + + /** + * Set our own PHP error handler + */ static function error_handler($errno, $errstr, $errfile, $errline) { $str = sprintf("%s\t%s\t%s\t%s\n", date("d.m @ H:i:s"), basename($errfile), $errline, $errstr); |