nest-bugsnag
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

Nest Logo

A Nest module wrapper for bugsnag logger.

NPM Version Package License NPM Downloads

Description

A Nest module wrapper for bugsnag-js logger.

Installation

$ npm i nest-bugsnag --save

Quick Start

Import the BugsnagModule into the module. For example AppModule:

import { Module } from '@nestjs/common';
import { BugsnagModule } from 'nest-bugsnag';
 
@Module({
  imports: [
    BugsnagModule.forRoot({
      // options
    }),
  ],
})
export class AppModule { }

Then you can inject BugsnagService. Example:

import { Controller } from '@nestjs/common';
import { BugsnagService } from 'nest-bugsnag';
 
@Controller('cats')
export class CatsController {
  constructor(private readonly logger: BugsnagService) { }
}

BugsnagService has instance property which wrap bugsnag client. So you can access it by calling:

this.logger.instance.notify('message');

Note that BugsnagModule is a global module, it will be available in all you feature modules.

Async configuration Sample

import { Module } from '@nestjs/common';
import { BugsnagModule } from 'nest-bugsnag';
import { ConfigService } from 'nest-config';
 
@Module({
  imports: [
    BugsnagModule.forRootAsync({
      useFactory: (configService: ConfigService) => ({
        // options
      }),
      inject: [ConfigService],
    }),
  ],
})
export class AppModule { }

The factory might be async and is able to inject dependencies through the inject option.

Keywords

bugsnagJs, nestJs, logger

Readme

Keywords

Package Sidebar

Install

npm i nest-bugsnag

Weekly Downloads

153

Version

0.0.8

License

MIT

Unpacked Size

9.88 kB

Total Files

14

Last publish

Collaborators

  • cicd_vitamojo
  • eugeniu.megherea
  • alexscrvitamojo
  • nadejde
  • aistrati
  • roman.caraus