Coder Social home page Coder Social logo

michaeldeitcher / ember-cli-bugsnag Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adopted-ember-addons/ember-cli-bugsnag

0.0 0.0 0.0 243 KB

Integrates Bugsnag reporting service into your Ember CLI app.

License: MIT License

JavaScript 91.26% HTML 8.74%

ember-cli-bugsnag's Introduction

Ember-cli-bugsnag

Build Status

Installation

Install the addon:

ember install ember-cli-bugsnag

Configuration

There are two ways to configure ember-cli-bugsnag:

  1. Add POJO to config/environment:
{
  bugsnag: {
    apiKey: '',
    notifyReleaseStages: ['development', 'production']
  }
}

The releaseStage defaults to the current application environment, if you need to set a different releaseStage that diverges from the environment, you can pass and additional attribute to the bugsnag configuration called releaseStage. It would look like this:

{
  bugsnag: {
    apiKey: '',
    notifyReleaseStages: ['development', 'production', 'staging'],
    releaseStage: 'staging'
  }
}
  1. Specify environment variables:
export BUGSNAG_API_KEY=''
export BUGSNAG_NOTIFY_RELEASE='development,production'

Configuration options:

  • config.bugsnag.apiKey / BUGSNAG_API_KEY -- required
  • config.bugsnag.notifyReleaseStages / BUGSNAG_NOTIFY_RELEASE -- optional, defaults to [] (never notify).
  • config.bugsnag.releaseStage / BUGSNAG_RELEASE_STAGE -- optional, defaults to config.environment.
  • config.bugsnag.endpoint / BUGSNAG_ENDPOINT -- optional, defaults to what the libraryUrl uses.
  • config.currentRevision -- any string representing the current version of the app, e.g. "1b8ef2c7" or "v1.2.4", optional.
    • Defaults to the version specified in package.json, e.g. 0.1.0.
    • This can be set automatically at build time with ember-git-version.

Customization

In order to send additional data along with errors reported to Bugsnag, generate a utility named bugsnag:

ember g util bugsnag

Custom Diagnostics (docs)

To send custom meta data, define a helper method getMetaData in the app/utils/bugsnag.js you created. getMetaData takes the error and the container as arguments, e.g.:

export function getMetaData(error, container) {
  return {
    // …some meta data
  };
}

ember-cli-bugsnag calls this method for every error and reports any data returned by it to Bugsnag as meta data for the respective error. The returned metaData should be formatted to correspond with tabs in your interface. E.g. for an Account tab:

return {
  account: {
    name: "Bugsnag",
    plan: "premium",
    beta_access: true
  }
};

Identifying Users (docs)

To correlate a specific user to an error and have the information appear in the User tab in the Bugsnag UI, send user data with each error data. Define a helper method getUser in the app/utils/bugsnag.js you created. getUser takes the container as an argument. For example, if you have a currentUser service that references a user model in your app:

import Ember from 'ember';

const {
  getProperties
} = Ember;

export function getUser(owner) {
  const currentUser = owner.lookup('service:current-user').get('user');
  const {
    email,
    id,
    fullName: name
  } = getProperties(currentUser, 'email', 'id', 'fullName');

  return {
    email,
    id,
    name
  };
}

Uploading Sourcemaps (docs)

Uploading sourcemaps to Bugsnag makes it easier to track down errors in your code because the stacktrace for each error in the Bugsnag UI highlights the exact line in your unminified source code. To send sourcemaps Bugsnag, use the Ember CLI Deploy addon ember-cli-deploy-bugsnag.

ember-cli-bugsnag's People

Contributors

cibernox avatar cigoe avatar ember-tomster avatar josemarluedke avatar josex2r avatar kategengler avatar kcincode avatar marcoow avatar michaeldeitcher avatar mmun avatar odoe avatar patrickberkeley avatar rlivsey avatar seawatts avatar twokul avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.