add a little more exit logging

This commit is contained in:
Stewart Allen 2020-03-12 17:18:50 -04:00
commit d53f51a6aa

View file

@ -356,7 +356,7 @@ function setup(req, res, next) {
req.method, req.method,
req.headers['host'], req.headers['host'],
req.url, req.url,
ipaddr, req.socket.remoteAddress,
req.headers['origin'] || '', req.headers['origin'] || '',
req.headers['user-agent'] req.headers['user-agent']
// m: req.method, // m: req.method,
@ -1224,6 +1224,7 @@ function processLoad() {
} }
function processExit(code) { function processExit(code) {
logger.emit({exit: code, registered: exits.length});
while (exits.length) { while (exits.length) {
try { try {
exits.shift()(code); exits.shift()(code);
@ -1307,14 +1308,16 @@ process.on('beforeExit', processExit);
process.on('exit', processExit); process.on('exit', processExit);
process.on('SIGINT', function() { process.on('SIGINT', function(sig, code) {
helper.log("caught sigint"); helper.log("caught sigint");
processExit(); logger.emit({signal: sig, code});
processExit(code);
}); });
process.on('SIGHUP', function() { process.on('SIGHUP', function(sig, code) {
helper.log("caught sighup"); helper.log("caught sighup");
processExit(); logger.emit({signal: sig, code});
processExit(code);
}); });
processLoad(); processLoad();