feat: exception logger (#4059)

This commit is contained in:
X1a0t
2023-09-01 12:05:35 +08:00
committed by GitHub
parent b0024080bd
commit d4a83c1c6f
4 changed files with 54 additions and 15 deletions
+14 -2
View File
@@ -1,6 +1,8 @@
import { DynamicModule, Type } from '@nestjs/common';
import { DynamicModule, Provider, Type } from '@nestjs/common';
import { APP_FILTER } from '@nestjs/core';
import { GqlModule } from '../graphql.module';
import { ExceptionLogger } from '../middleware/exception-logger';
import { AuthModule } from './auth';
import { DocModule } from './doc';
import { SyncModule } from './sync';
@@ -8,6 +10,7 @@ import { UsersModule } from './users';
import { WorkspaceModule } from './workspaces';
const { SERVER_FLAVOR } = process.env;
const { NODE_ENV } = process.env;
const BusinessModules: (Type | DynamicModule)[] = [];
@@ -37,4 +40,13 @@ switch (SERVER_FLAVOR) {
break;
}
export { BusinessModules };
const Providers: Provider[] = [];
if (NODE_ENV !== 'test') {
Providers.push({
provide: APP_FILTER,
useClass: ExceptionLogger,
});
}
export { BusinessModules, Providers };