forked from FoundKeyGang/FoundKey
Merge branch 'master' of https://github.com/syuilo/misskey
This commit is contained in:
commit
73c328f90b
2 changed files with 6 additions and 3 deletions
|
@ -122,11 +122,13 @@ async function init(): Promise<Config> {
|
||||||
configLogger.info(`Maintainer: ${config.maintainer.name}`);
|
configLogger.info(`Maintainer: ${config.maintainer.name}`);
|
||||||
|
|
||||||
if (process.platform === 'linux' && !isRoot() && config.port < 1024) {
|
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') {
|
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
|
// Try to connect to MongoDB
|
||||||
|
|
|
@ -20,7 +20,8 @@ export default class Logger {
|
||||||
public static log(level: LogLevel, message: string): void {
|
public static log(level: LogLevel, message: string): void {
|
||||||
const color = toLevelColor(level);
|
const color = toLevelColor(level);
|
||||||
const time = (new Date()).toLocaleTimeString('ja-JP');
|
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 {
|
public static error(message: string): void {
|
||||||
|
|
Loading…
Reference in a new issue