Add logs to server
This commit is contained in:
+7
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user