Merge pull request #1927 from ether/fix/client-side-error-logging-in-server-log
Polish logging of client-side errors on the server
This commit is contained in:
commit
de50efc71a
|
@ -1,5 +1,6 @@
|
||||||
var log4js = require('log4js');
|
var log4js = require('log4js');
|
||||||
var apiLogger = log4js.getLogger("API");
|
var apiLogger = log4js.getLogger("API");
|
||||||
|
var clientLogger = log4js.getLogger("client");
|
||||||
var formidable = require('formidable');
|
var formidable = require('formidable');
|
||||||
var apiHandler = require('../../handler/APIHandler');
|
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) {
|
args.app.post('/ep/pad/connection-diagnostic-info', function(req, res) {
|
||||||
new formidable.IncomingForm().parse(req, function(err, fields, files) {
|
new formidable.IncomingForm().parse(req, function(err, fields, files) {
|
||||||
console.log("DIAGNOSTIC-INFO: " + fields.diagnosticInfo);
|
clientLogger.info("DIAGNOSTIC-INFO: " + fields.diagnosticInfo);
|
||||||
res.end("OK");
|
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
|
//The Etherpad client side sends information about client side javscript errors
|
||||||
args.app.post('/jserror', function(req, res) {
|
args.app.post('/jserror', function(req, res) {
|
||||||
new formidable.IncomingForm().parse(req, function(err, fields, files) {
|
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");
|
res.end("OK");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue