angular-airbrake

Angular 2+ Service for Airbrake error logging

Usage no npm install needed!

<script type="module">
  import angularAirbrake from 'https://cdn.skypack.dev/angular-airbrake';
</script>

README

Angular (2+) Airbrake Integration

Build Status Coverage Status

This package provides an Angular 2+ service for logging to Airbrake.

Installation

npm install angular-airbrake

Dependencies

This module relies on the official airbrake-js npm package. In addition, it has Angular >= 2 as a peer dependency.

Usage

Bootstrap the module

import { AirbrakeModule, AirbrakeService } from 'angular-airbrake'

NgModule({
    imports: [
        AirbrakeModule.forRoot({
            // Your Airbrake options here, follow the Airbrake documentation
        })
    ],
    providers: [
        { provide: ErrorHandler, useClass: AirbrakeService }
    ]
})
export class MyAngularApp {}

Use the service

Let the Angular DI do all the magic for you.

import { Component } from '@angular/core'
import { AirbrakeService } from 'angular-airbrake';

@Component(...)
export class MyComponent {

    constructor (airbrake: AirbrakeService) {
        airbrake.error('Logging to Airbrake!');
    }
}

Development

We are using Angular CLI to make things a little bearable.

npm install
npm test

Disclaimer

This project is not affiliated in anyway with Airbrake.