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

9.1.2 • Public • Published

 

@edirect/logger

The EDirectInsure Logger module.

Installation

$ npm i --save @edirect/logger

Usage

Import and register LoggerModule on AppModule (app.module.ts):

imports: [
  ...
  LoggerModule.register({
    output: "output",
    logs: {
    errorFile: "error_file",
    warningFile: "warning_file",
    infoFile: "info_file",
    },
    name: 'subscription-service',
  }),
  ...
]

OR

import { ConfigService } from '@edirect/config';

...

imports: [
  ...
  LoggerModule.registerAsync({
    imports: [ConfigModule],
    useFactory: async (configService: ConfigService) => ({
      output: configService.get(Variables.LOGS_OUTPUT),
      logs: {
        errorFile: configService.get(Variables.LOGS_ERROR_FILE),
        warningFile: configService.get(Variables.LOGS_WARNING_FILE),
        infoFile: configService.get(Variables.LOGS_INFO_FILE),
      },
      name: 'subscription-service',
    }),
    inject: [ConfigService],
  }),
  ...
]

Inject the LoggerService where needed:

constructor(
  private loggerService: LoggerService
) {}

Log using the exposed methods:

this.loggerService.log(message: string, payload?: string)
this.loggerService.info(message: string, payload?: string)
this.loggerService.warn(message: string, payload: string)
this.loggerService.error(message: string, trace: string)
this.loggerService.debug(message: string)
this.loggerService.verbose(message: string)

/@edirect/logger/

    Package Sidebar

    Install

    npm i @edirect/logger

    Weekly Downloads

    43

    Version

    9.1.2

    License

    ISC

    Unpacked Size

    99 kB

    Total Files

    25

    Last publish

    Collaborators

    • rodrigo.prado
    • michel.bolttech
    • diogo.bolttech
    • mathais
    • robertoakang
    • samuelbolttech
    • gcmercante
    • herberts.fortuna
    • bruno.gomes
    • danielkhalebbatista
    • andsfranbolt
    • guilherme_benedeti
    • pauloazevedo-ed
    • rafael.jourdan
    • joaoferreirabolttech
    • iquirino.bolttech
    • lukaspiccinibt
    • adailson.bolttech
    • palvares_bolttech
    • plinio.altoe
    • edirectamorim
    • ricardo.coelho
    • layunne-bolttech
    • mayko.calazans
    • david.pereira
    • paulomarchi