0.8.5 • Published 5 years ago

digicodeslots-winston-logger v0.8.5

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Digicodeslots winston logger

This package is nestjs logger based on winston logger

Install:

$ npm install digicodeslots-winston-logger

Settings:

This logger is use two transports:

  • winston.transports.File

process.env.LOG_APP_ID - to define logs file

process.env.LOG_DIRNAME - to define logs file directory

  • winston.transports.Http

process.env.LOG_HOST - to define host of logger

process.env.LOG_PORT - to define logger port of host

Also if set process.env.NODE_ENV = 'development' will be show logs in process terminal

Examples | How use:

  • Interceptor
import { LoggerInterceptor } from 'digicodeslots-winston-logger';

@UseInterceptors(LoggerInterceptor)
@Injectable()
export class YourService {
  ...
  • Service
import { LoggerService } from 'digicodeslots-winston-logger';

const logger = new LoggerService('example-context'); // 'example-context' to set 'context' property in logs

// Then you can use it any where like

async function bootstrap() {
  logger.log('App is starting');
  ...
  • Decorator on promise
import { LoggerWrap } from 'digicodeslots-winston-logger';
...

@Injectable()
export class OwnService {
...
@LoggerWrap('newBet')
await newBet(): Promise<any> {
  await this.roundService.findLastCompletedRoundBySessionId();
}
...

Logger will be create two records. One record on start and then second on end of execution promise

  • ExceptionFilter filter

This is implemented of ExceptionFilter(@nestjs/common)

import { APIExceptionFilter } from 'digicodeslots-winston-logger';

Links

Nestjs https://nestjs.com

Winston https://www.npmjs.com/package/winston

0.8.5

5 years ago

0.8.4

5 years ago

0.8.3

5 years ago

0.8.2

5 years ago

0.8.1

5 years ago

0.8.0

5 years ago

0.7.6

5 years ago

0.7.5

5 years ago

0.7.4

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.2

5 years ago

0.3.2

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago