0.2.0 • Published 3 years ago

@ffdc/logger v0.2.0

Weekly downloads
52
License
MIT
Repository
github
Last release
3 years ago

Logger module

NestJS module to log in specific formats :

  • Azure Monitor (previously OMS)

Use it

Import the logger module in your main module

app.module.ts

@Module({
  imports: [
    LoggerModule,
    ...
  ],
})
export class AppModule {}

Define which module to use in the bootstrapping of your app :

main.ts

const omsLogger = new OMSLogger();
const app = await NestFactory.create(AppModule, {
  logger: omsLogger,
});
app.useLogger(omsLogger);
app.useGlobalInterceptors(new HttpLoggingInterceptor());

GraphQL

If you're using GraphQL in your application, there's another interceptor for you :

app.useGlobalInterceptors(new GraphQLLoggingInterceptor());