Update cli.ts
This commit is contained in:
parent
99fb6e864e
commit
31186262fa
|
@ -6,35 +6,15 @@
|
||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
import { EventEmitter } from 'node:events';
|
import { EventEmitter } from 'node:events';
|
||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import Logger from '@/logger.js';
|
|
||||||
import { CommandModule } from '@/cli/CommandModule.js';
|
import { CommandModule } from '@/cli/CommandModule.js';
|
||||||
import { NestLogger } from '@/NestLogger.js';
|
import { NestLogger } from '@/NestLogger.js';
|
||||||
import { CommandService } from '@/cli/CommandService.js';
|
import { CommandService } from '@/cli/CommandService.js';
|
||||||
import { envOption } from '../env.js';
|
|
||||||
|
|
||||||
process.title = 'Misskey Cli';
|
process.title = 'Misskey Cli';
|
||||||
|
|
||||||
Error.stackTraceLimit = Infinity;
|
Error.stackTraceLimit = Infinity;
|
||||||
EventEmitter.defaultMaxListeners = 128;
|
EventEmitter.defaultMaxListeners = 128;
|
||||||
|
|
||||||
const logger = new Logger('core', 'cyan');
|
|
||||||
|
|
||||||
//#region Events
|
|
||||||
|
|
||||||
// Display detail of unhandled promise rejection
|
|
||||||
if (!envOption.quiet) {
|
|
||||||
process.on('unhandledRejection', console.dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display detail of uncaught exception
|
|
||||||
process.on('uncaughtException', err => {
|
|
||||||
try {
|
|
||||||
logger.error(err);
|
|
||||||
console.trace(err);
|
|
||||||
} catch { }
|
|
||||||
});
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
const app = await NestFactory.createApplicationContext(CommandModule, {
|
const app = await NestFactory.createApplicationContext(CommandModule, {
|
||||||
logger: new NestLogger(),
|
logger: new NestLogger(),
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue