tweaked some logging

This commit is contained in:
tigerbot 2017-09-11 15:57:25 -06:00
parent c47b1dc235
commit 44d11e094b
2 changed files with 19 additions and 2 deletions

View File

@ -53,8 +53,24 @@ module.exports.create = function (deps, config) {
conn.close();
}
function netHandler(conn, opts) {
function getProp(name) {
return opts[name] || opts['_'+name] || conn[name] || conn['_'+name];
}
opts = opts || {};
console.log('[netHandler]', conn.localAddress, conn.localPort, opts.encrypted);
var logName = getProp('remoteAddress') + ':' + getProp('remotePort') + ' -> ' +
getProp('localAddress') + ':' + getProp('localPort');
console.log('[netHandler]', logName, 'encrypted: '+opts.encrypted);
var start = Date.now();
conn.on('timeout', function () {
console.log('[netHandler]', logName, 'connection timed out', (Date.now()-start)/1000);
});
conn.on('end', function () {
console.log('[netHandler]', logName, 'connection ended', (Date.now()-start)/1000);
});
conn.on('close', function () {
console.log('[netHandler]', logName, 'connection closed', (Date.now()-start)/1000);
});
// XXX PEEK COMMENT XXX
// TODO we can have our cake and eat it too

View File

@ -426,8 +426,9 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
if (handled) { return handled; }
return moduleChecks[mod.name](mod, conn, opts, headers);
});
}
} else {
console.warn('unknown HTTP module under domains', dom.names.join(','), mod);
}
});
return subProm;
});