@nest-toolbox/winston-logger
v1.5.1
Published
nestjs toolbox
Downloads
180
Readme
Winston Logger Service
NestJS LoggerService that uses Winston.
Installation
npm i @nest-toolbox/winston-logger
Example
You can pass any custom transports supported by Winston
import { NestFactory } from '@nestjs/core';
import { WinstonLoggerService } from '@nest-toolbox/winston-logger';
import { AppModule } from './app.module';
import * as winston from 'winston';
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(
ApplicationModule,
{
logger: new WinstonLoggerService({
projectName: 'project',
}),
},
);
const app = await NestFactory.create<NestExpressApplication>(
ApplicationModule,
{
logger: new WinstonLoggerService({
projectName: 'project',
transports: [
new winston.transports.File({
filename: 'combined.log',
level: 'info',
}),
],
}),
},
);
await app.listen(3000);
}
bootstrap();
WinstonLoggerService constructor options
options: {
projectName: string,
transports?: any[],
timeFormatStr?: string,
customFormatter?: any
}