0.0.9 • Published 3 years ago

@ccmos/nestjs-winston-logger v0.0.9

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

Description

winstonjs module for Nest.

Installation

$ npm install @ccmos/nestjs-winston-logger

Quick Start

// import
import { Module } from '@nestjs/common';
import { WinstonLoggerModule } from '@ccmos/nestjs-winston-logger';

@Module({
  imports: [
    WinstonLoggerModule.forRoot({
      level: 'debug'
    }),
  ],
})
export class AppModule {}

// service
import { Injectable } from '@nestjs/common';
import { WinstonLoggerService } from '@ccmos/nestjs-winston-logger';

@Injectable()
export class MyService {
  constructor(
    private logger: WinstonLoggerService,
  ) {
    this.logger.setContext(MyService.name);
  }

  helloWorld() {
    this.logger.info('hello-world.info', { foo: 'bar' });
  }
}

License

Nest is MIT licensed.