summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-03-05 10:50:15 +0300
committerAndrew Dolgov <[email protected]>2017-03-05 10:50:15 +0300
commit270c0a00e5d9c8ce8a120bd48575d36c7ceaca0e (patch)
treed435a0d53d0da3dd7a0553cf4d99d45ccc40c7aa /classes
parente0a957b3f66f1fb35060e51c63f0a271d9a7d938 (diff)
improve JS error logging with additional stuff
Diffstat (limited to 'classes')
-rwxr-xr-xclasses/rpc.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/classes/rpc.php b/classes/rpc.php
index 2a92eadbd..fd10a3a49 100755
--- a/classes/rpc.php
+++ b/classes/rpc.php
@@ -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"));
+ }
}
}