forked from ZyntariHQ/Invoisio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobservability.module.ts
More file actions
30 lines (29 loc) · 973 Bytes
/
Copy pathobservability.module.ts
File metadata and controls
30 lines (29 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Global, MiddlewareConsumer, Module, NestModule } from "@nestjs/common";
import { APP_FILTER, APP_INTERCEPTOR } from "@nestjs/core";
import { CorrelationIdMiddleware } from "./correlation-id.middleware";
import { HttpExceptionFilter } from "./http-exception.filter";
import { LoggingInterceptor } from "./logging.interceptor";
import { RequestContextService } from "./request-context.service";
import { StructuredLogger } from "./structured-logger.service";
@Global()
@Module({
providers: [
RequestContextService,
StructuredLogger,
CorrelationIdMiddleware,
{
provide: APP_INTERCEPTOR,
useClass: LoggingInterceptor,
},
{
provide: APP_FILTER,
useClass: HttpExceptionFilter,
},
],
exports: [RequestContextService, StructuredLogger],
})
export class ObservabilityModule implements NestModule {
configure(consumer: MiddlewareConsumer): void {
consumer.apply(CorrelationIdMiddleware).forRoutes("*");
}
}