From c66532d18fcec1012cd1e24bc10dffba54612878 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Fri, 13 Jul 2018 23:51:16 +0900 Subject: [PATCH 1/3] Update logger --- src/misc/logger.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/misc/logger.ts b/src/misc/logger.ts index fae1042c39..deb5bab17a 100644 --- a/src/misc/logger.ts +++ b/src/misc/logger.ts @@ -20,7 +20,8 @@ export default class Logger { public static log(level: LogLevel, message: string): void { const color = toLevelColor(level); const time = (new Date()).toLocaleTimeString('ja-JP'); - console.log(`[${time} ${color.bold(level.toUpperCase())}]: ${message}`); + const coloredMessage = level === 'Info' ? message : color.bold(message); + console.log(`[${time} ${color.bold(level.toUpperCase())}]: ${coloredMessage}`); } public static error(message: string): void { From 874837666ce7429a59ad41972532e3d447e17a88 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Fri, 13 Jul 2018 23:52:28 +0900 Subject: [PATCH 2/3] Update error message --- src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index c5f5d32e57..44d42f94c1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -122,11 +122,13 @@ async function init(): Promise { configLogger.info(`Maintainer: ${config.maintainer.name}`); if (process.platform === 'linux' && !isRoot() && config.port < 1024) { - throw 'You need root privileges to listen on port below 1024 on Linux'; + Logger.error('You need root privileges to listen on port below 1024 on Linux'); + process.exit(1); } if (await portscanner.checkPortStatus(config.port, '127.0.0.1') === 'open') { - throw `Port ${config.port} is already in use`; + Logger.error(`Port ${config.port} is already in use`) + process.exit(1); } // Try to connect to MongoDB From 98ea2380878bbfae8070dcfcc84ca4caf10eeed9 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 14 Jul 2018 00:05:49 +0900 Subject: [PATCH 3/3] Add missing semicolon --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 44d42f94c1..879e5ceee1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -127,7 +127,7 @@ async function init(): Promise { } if (await portscanner.checkPortStatus(config.port, '127.0.0.1') === 'open') { - Logger.error(`Port ${config.port} is already in use`) + Logger.error(`Port ${config.port} is already in use`); process.exit(1); }