1.0.2 • Published 3 years ago

fologger-nestjs v1.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
3 years ago

FOLogger-nestjs

nest-js logging module with custom Fusion Operate formatter.

How to install

  1. Install npm package:

    npm install fologger-nestjs

  2. Import module into your appication

    ```
    // app.module.ts
    import { FOLoggerModule, LoggingInterceptor } from 'fologger-nestjs';
    ```

    3 Register module import and LoggingInterceptor provider

    @Module({
      imports: [FOLoggerModule],
      providers: [LoggingInterceptor],
    })
    export class AppModule {}
    ```

How to use

In your service register DI JsonLogger and use logger instance methods in your class functions:

@Controller()
export class AppController {
  constructor(private _logger: JsonLogger) {
    this._logger.setContext('AppController'); //optionally set context
  }

  @Get()
  getHello(): string {
    this._logger.log('getHello invoked'); // Logger will log message with context 'AppController'
    return this._appService.getHello();
  }

For detailed usage examples, please see Fusion Opeate nest-helloworld template project.

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0-1

3 years ago

1.0.0

3 years ago