mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-19 04:17:44 +00:00
logging
This commit is contained in:
@@ -83,7 +83,10 @@ module.exports = function(srf, logger) {
|
||||
else app.notifier = {request: () => {}};
|
||||
|
||||
req.locals.application = app;
|
||||
logger.debug(app, `retrieved application for ${req.locals.calledNumber}`);
|
||||
const obj = Object.assign({}, app);
|
||||
delete obj.requestor;
|
||||
delete obj.notifier;
|
||||
logger.info({app: obj}, `retrieved application for incoming call to ${req.locals.calledNumber}`);
|
||||
req.locals.callInfo = new CallInfo({req, app, direction: CallDirection.Inbound});
|
||||
next();
|
||||
} catch (err) {
|
||||
|
||||
@@ -555,7 +555,7 @@ class CallSession extends Emitter {
|
||||
}
|
||||
|
||||
// update calls db
|
||||
this.logger.debug(`updating redis with ${JSON.stringify(this.callInfo)}`);
|
||||
//this.logger.debug(`updating redis with ${JSON.stringify(this.callInfo)}`);
|
||||
this.updateCallStatus(Object.assign({}, this.callInfo), this.serviceUrl)
|
||||
.catch((err) => this.logger.error(err, 'redis error'));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ function makeTask(logger, obj, parent) {
|
||||
}
|
||||
const name = keys[0];
|
||||
const data = obj[name];
|
||||
logger.debug(data, `makeTask: ${name}`);
|
||||
//logger.debug(data, `makeTask: ${name}`);
|
||||
if (typeof data !== 'object') {
|
||||
throw errBadInstruction;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class TaskTag extends Task {
|
||||
async exec(cs) {
|
||||
super.exec(cs);
|
||||
cs.callInfo.customerData = this.data;
|
||||
this.logger.debug({callInfo: cs.callInfo.toJSON()}, 'TaskTag:exec set customer data in callInfo');
|
||||
//this.logger.debug({callInfo: cs.callInfo.toJSON()}, 'TaskTag:exec set customer data in callInfo');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
function normalizeJambones(logger, obj) {
|
||||
logger.debug(`normalizeJambones: ${JSON.stringify(obj)}`);
|
||||
if (!Array.isArray(obj)) throw new Error('malformed jambonz payload: must be array');
|
||||
const document = [];
|
||||
for (const tdata of obj) {
|
||||
@@ -17,7 +16,6 @@ function normalizeJambones(logger, obj) {
|
||||
}
|
||||
else if (Object.keys(tdata).length === 1) {
|
||||
// {'say': {..}}
|
||||
logger.debug(`pushing ${JSON.stringify(tdata)}`);
|
||||
document.push(tdata);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -86,12 +86,12 @@ class Requestor {
|
||||
const diff = process.hrtime(startAt);
|
||||
const time = diff[0] * 1e3 + diff[1] * 1e-6;
|
||||
const rtt = time.toFixed(0);
|
||||
this.logger.debug(`Requestor:request ${method} ${url} succeeded in ${rtt}ms`);
|
||||
if (buf) this.stats.histogram('app.hook.response_time', rtt, ['hook_type:app']);
|
||||
|
||||
if (buf && buf.toString().length > 0) {
|
||||
try {
|
||||
const json = JSON.parse(buf.toString());
|
||||
this.logger.info({response: json}, `Requestor:request ${method} ${url} succeeded in ${rtt}ms`);
|
||||
return json;
|
||||
}
|
||||
catch (err) {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"ip": "^1.1.5",
|
||||
"cidr-matcher": "^2.1.1",
|
||||
"jambonz-db-helpers": "^0.3.2",
|
||||
"jambonz-realtimedb-helpers": "^0.1.7",
|
||||
"jambonz-realtimedb-helpers": "^0.1.8",
|
||||
"jambonz-stats-collector": "^0.0.3",
|
||||
"moment": "^2.24.0",
|
||||
"parse-url": "^5.0.1",
|
||||
|
||||
Reference in New Issue
Block a user