mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
/jserror: Log all of the provided data
This commit is contained in:
parent
cb01ae8cbb
commit
629e7d5072
1 changed files with 8 additions and 1 deletions
|
@ -4,6 +4,7 @@ const log4js = require('log4js');
|
||||||
const clientLogger = log4js.getLogger('client');
|
const clientLogger = log4js.getLogger('client');
|
||||||
const formidable = require('formidable');
|
const formidable = require('formidable');
|
||||||
const apiHandler = require('../../handler/APIHandler');
|
const apiHandler = require('../../handler/APIHandler');
|
||||||
|
const util = require('util');
|
||||||
|
|
||||||
exports.expressCreateServer = (hookName, args, cb) => {
|
exports.expressCreateServer = (hookName, args, cb) => {
|
||||||
// The Etherpad client side sends information about how a disconnect happened
|
// The Etherpad client side sends information about how a disconnect happened
|
||||||
|
@ -25,7 +26,13 @@ exports.expressCreateServer = (hookName, args, cb) => {
|
||||||
args.app.post('/jserror', (req, res, next) => {
|
args.app.post('/jserror', (req, res, next) => {
|
||||||
(async () => {
|
(async () => {
|
||||||
const data = JSON.parse(await parseJserrorForm(req));
|
const data = JSON.parse(await parseJserrorForm(req));
|
||||||
clientLogger.warn(`${data.msg} --`, data);
|
clientLogger.warn(`${data.msg} --`, {
|
||||||
|
[util.inspect.custom]: (depth, options) => {
|
||||||
|
// Depth is forced to infinity to ensure that all of the provided data is logged.
|
||||||
|
options = Object.assign({}, options, {depth: Infinity});
|
||||||
|
return util.inspect(data, options);
|
||||||
|
},
|
||||||
|
});
|
||||||
res.end('OK');
|
res.end('OK');
|
||||||
})().catch((err) => next(err || new Error(err)));
|
})().catch((err) => next(err || new Error(err)));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue