Add logs to server

This commit is contained in:
Ted Spare
2024-03-14 22:59:17 -04:00
committed by GitHub
parent 78c06f8fc4
commit 355d3bf1d4
+7 -5
View File
@@ -2,10 +2,7 @@
import 'localenv';
import optimist from 'optimist';
import log from 'book';
import Debug from 'debug';
import CreateServer from '../server';
const debug = Debug('localtunnel');
@@ -34,6 +31,7 @@ const argv = optimist
.argv;
if (argv.help) {
console.log("Showing help");
optimist.showHelp();
process.exit();
}
@@ -49,19 +47,23 @@ server.listen(argv.port, argv.address, () => {
});
process.on('SIGINT', () => {
console.error("SIGINT");
process.exit();
});
process.on('SIGTERM', () => {
console.error("SIGTERM");
process.exit();
});
process.on('uncaughtException', (err) => {
log.error(err);
console.error("err:");
console.error(err);
});
process.on('unhandledRejection', (reason, promise) => {
log.error(reason);
console.error("reason:");
console.error(reason);
});
// vim: ft=javascript