9.1.2 • Published 2 years ago

@edirect/logger v9.1.2

Weekly downloads
85
License
ISC
Repository
-
Last release
2 years ago

 

@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)
9.1.2

2 years ago

9.1.1

2 years ago

9.1.0

2 years ago

9.0.0

3 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago