]> git.wh0rd.org - tt-rss.git/blobdiff - classes/rpc.php
improve JS error logging with additional stuff
[tt-rss.git] / classes / rpc.php
index 2a92eadbd3b607f2703d90c36d58011503e1f73c..fd10a3a496b70d0a859333e746e84d0fe725a641 100755 (executable)
@@ -647,14 +647,19 @@ class RPC extends Handler_Protected {
        }
 
        function log() {
-               $logmsg = $this->dbh->escape_string($_REQUEST['logmsg']);
+               $msg = $this->dbh->escape_string($_REQUEST['msg']);
+               $file = $this->dbh->escape_string(basename($_REQUEST['file']));
+               $line = (int) $_REQUEST['line'];
+               $context = $this->dbh->escape_string($_REQUEST['context']);
 
-               if ($logmsg) {
+               if ($msg) {
                        Logger::get()->log_error(E_USER_WARNING,
-                               $logmsg, '[client-js]', 0, false);
-               }
+                               $msg, 'client-js:' . $file, $line, $context);
 
-               echo json_encode(array("message" => "HOST_ERROR_LOGGED"));
+                       echo json_encode(array("message" => "HOST_ERROR_LOGGED"));
+               } else {
+                       echo json_encode(array("error" => "MESSAGE_NOT_FOUND"));
+               }
 
        }
 }