@globaluy/winston
v2.0.3
Published
Nest logger module.
Downloads
47
Readme
Description
Nest logger module.
Usage options
app.module.ts
LoggerModule.forRoot(),
LoggerModule.forRoot({
type: WinstonTransportEnum.logtail,
transport: {
secret: 'secret',
},
}),
LoggerModule.forRoot({
type: WinstonTransportEnum.logstash,
transport: {
host: 'host',
port: 'port',
index: 'index',
},
}),
LoggerModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
type: WinstonTransportEnum.logtail,
transport: {
secret: configService.get('logger.secret'),
},
}),
}),
LoggerModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
type: WinstonTransportEnum.logstash,
transport: configService.get('logger.transport'),
...OR
transport: {
host: configService.get('logger.host'),
port: configService.get('logger.port'),
index: configService.get('logger.index'),
},
}),
}),
main.ts
const logger = app.get(WinstonLogger);
app.useLogger(logger);