npm.io
0.1.4 • Published 2 years ago

nestlibs-winston-logger

Licence
Version
0.1.4
Deps
3
Size
11 kB
Vulns
0
Weekly
3

nestlibs-winston-logger

This package is for self use. Feel free to use it if you find it useful.
A simple wrapper around the winston logger with daily log rotation To log messages to file in NestJS application.

Installation

npm install nestlibs-winston-logger

Usage

import { LoggerModule } from '@nestlibs/winston-logger';

@Module({
  // appName will be used as logs folder name (logs/appName/***.log)
  imports: [LoggerModule.forRoot('appName', options)],
})
export class AppModule {}
import { LoggerService } from '@nestlibs/winston-logger';

@Injectable()
export class AppService {
  constructor(private readonly logger: LoggerService) {
    this.logger.log('Hello World!');
  }
}

Options

Methods

type LogError = string | Error;

  • log(message: LogError)
  • info(message: LogError)
  • error(message: LogError, trace?: string)
  • warn(message: LogError)
  • debug(message: LogError)
  • verbose(message: LogError)