contactlab / contactsnag

Bugsnag wrapper and utilities for Contactlab's applications
https://contactlab.github.io/contactsnag
Apache License 2.0
3 stars 0 forks source link

Bugsnag new api and lazy initialization #26

Closed StefanoMagrassi closed 5 years ago

StefanoMagrassi commented 5 years ago

Upgrade Bugsnag to the new version and make the library configuration/initialization lazy (ref)

From this:

import Bugsnag from 'bugsnag-js';
import project from './../../package.json';

// Bugsnag configuration
Bugsnag.apiKey = project.bugsnag.apiKey;
Bugsnag.endpoint = 'https://notify-bugsnag.contactlab.it/js';
Bugsnag.user = null;
Bugsnag.notifyReleaseStages = ['development'];
Bugsnag.releaseStage = 'development';
Bugsnag.context = null;
Bugsnag.disableAutoBreadcrumbsConsole();

// Export instance reference of Bugsnag
export const ContactSnag = Bugsnag;

to this (TBD):

import bugsnag from '@bugsnag/js';

const DEFAULT_CONFIG = {
  endpoint: 'https://notify-bugsnag.contactlab.it/js',
  // notifyReleaseStages: ['production'],
  // releaseStage: 'production',
  consoleBreadcrumbsEnabled: false
};

export const ContactSnag = (apiKey, config) =>  bugsnag({...DEFAULT_CONFIG, ...config, apiKey});
StefanoMagrassi commented 5 years ago

resolved by #30