@nest-toolbox/winston-logger
TypeScript icon, indicating that this package has built-in type declarations

1.5.1 • Public • Published

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
}

Package Sidebar

Install

npm i @nest-toolbox/winston-logger

Weekly Downloads

23

Version

1.5.1

License

MIT

Unpacked Size

91.3 kB

Total Files

10

Last publish

Collaborators

  • lupu60