aboutsummaryrefslogtreecommitdiffstats
path: root/App.php
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mekanisti.fi>2009-10-26 15:19:28 +0200
committerFilipp Lepalaan <filipp@mekanisti.fi>2009-10-26 15:19:28 +0200
commitb69995e1d0bcd5ea1185acfda4899e11f1d8e624 (patch)
treedb0a875dad27749ee2c072028cec32f867268392 /App.php
parent735c8bf38f0b1c66470fdff312eacfcc21ab8ae8 (diff)
downloadmain-b69995e1d0bcd5ea1185acfda4899e11f1d8e624.tar.gz
main-b69995e1d0bcd5ea1185acfda4899e11f1d8e624.tar.bz2
main-b69995e1d0bcd5ea1185acfda4899e11f1d8e624.zip
Some fixes
Diffstat (limited to 'App.php')
-rw-r--r--App.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/App.php b/App.php
index ec26b58..1978d29 100644
--- a/App.php
+++ b/App.php
@@ -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);