diff --git a/src/index.ts b/src/index.ts index c5f5d32e5..879e5ceee 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 diff --git a/src/misc/logger.ts b/src/misc/logger.ts index fae1042c3..deb5bab17 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 {