summaryrefslogtreecommitdiff
path: root/src/node/hooks/express/apicalls.js
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2013-10-10 18:45:22 +0200
committerMarcel Klehr <mklehr@gmx.net>2013-10-10 18:45:22 +0200
commitb7c7685dc70e98d66ae9d4e21d0f45b15177441d (patch)
tree22b9d8489a9d526fa3fc6b23654509def1b1e979 /src/node/hooks/express/apicalls.js
parentd86d99bc16a8c0027483f23c07e2b3063604c727 (diff)
downloadetherpad-lite-b7c7685dc70e98d66ae9d4e21d0f45b15177441d.zip
Polish logging of client-side errors on the server
Diffstat (limited to 'src/node/hooks/express/apicalls.js')
-rw-r--r--src/node/hooks/express/apicalls.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/node/hooks/express/apicalls.js b/src/node/hooks/express/apicalls.js
index 0971a877..db0fc81f 100644
--- a/src/node/hooks/express/apicalls.js
+++ b/src/node/hooks/express/apicalls.js
@@ -1,5 +1,6 @@
var log4js = require('log4js');
var apiLogger = log4js.getLogger("API");
+var clientLogger = log4js.getLogger("client");
var formidable = require('formidable');
var apiHandler = require('../../handler/APIHandler');
@@ -42,10 +43,10 @@ exports.expressCreateServer = function (hook_name, args, cb) {
});
});
- //The Etherpad client side sends information about how a disconnect happen
+ //The Etherpad client side sends information about how a disconnect happened
args.app.post('/ep/pad/connection-diagnostic-info', function(req, res) {
new formidable.IncomingForm().parse(req, function(err, fields, files) {
- console.log("DIAGNOSTIC-INFO: " + fields.diagnosticInfo);
+ clientLogger.info("DIAGNOSTIC-INFO: " + fields.diagnosticInfo);
res.end("OK");
});
});
@@ -53,7 +54,12 @@ exports.expressCreateServer = function (hook_name, args, cb) {
//The Etherpad client side sends information about client side javscript errors
args.app.post('/jserror', function(req, res) {
new formidable.IncomingForm().parse(req, function(err, fields, files) {
- console.error("CLIENT SIDE JAVASCRIPT ERROR: " + fields.errorInfo);
+ try {
+ var data = JSON.parse(fields.errorInfo)
+ }catch(e){
+ return res.end()
+ }
+ clientLogger.warn(data.msg+' --', data);
res.end("OK");
});
});