GithubHelp home page GithubHelp logo

mindscapehq / ember-cli-raygun Goto Github PK

View Code? Open in Web Editor NEW
15.0 30.0 9.0 4.24 MB

This addon will allow you to report errors to Raygun from your Ember CLI app using raygun4js

Home Page: https://raygun.com

License: MIT License

JavaScript 63.40% HTML 6.11% CSS 0.71% Handlebars 29.78%
ember-cli raygun ember-cli-raygun raygun4js

ember-cli-raygun's Introduction

Ember CLI Raygun

Build Status Ember Observer Score

This addon will allow you to report errors to Raygun from your Ember CLI app using raygun4js.

❤️ Please open an issue if you run into any troubles!


CLI installation

$ ember install ember-cli-raygun --api_key='paste_your_api_key_here'

Alternatively, you can set your API key manually by starting with:

$ ember install ember-cli-raygun

Next, set your API key in config/environment.js:

var ENV = {
  // ...
  raygun: {
    apiKey:  "paste_your_api_key_here",
    enableCrashReporting: (environment === "production")
  }
  // ...

The default blueprint (which runs during ember install ember-cli-raygun) will add the above config in your app's config/environment.js file.

Release

Raygun will now track errors in your deployed application. By default, Ember CLI Raygun is disabled unless your environment is set to "production". You can configure this behavior in config/environment.js.

Additional Configruation

CORS

ember-cli-raygun will automatically inject the raygun4js bootstrap script into the head of your Ember app. This is the most reliable way to catch errors (even during app initialization).

If you’re using CORS without unsafe-inline, you’ll need to add the following directives to ensure rg4js and Raygun load correctly:

Accessing Raygun

Functions you might need on rg4js are exposed as an Ember Service, for instance tracking custom events:

import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class IndexRoute extends Route {
  @service raygun;

  beforeModel() {
    this.raygun.trackEvent({
      type: 'customTiming',
      name: 'IndexRouteBeforeModel',
      duration: 1200
    })
  }
}

User Tracking

Check out the Customers section in the raygun4js documentation for full details.

Add the following snippet into your application route in app/routes/application.js:

// ...
  @service user;
  @service raygun;

  beforeModel: () {
    this.setRaygunUser();
  },

  setRaygunUser: () {
    this.raygun.setUser({
      identifier: this.get("user.id"),
      isAnonymous: false,
      email: this.get("user.email"),
      firstName: this.get("user.firstName"),
      fullName: this.get("user.fullName")
    });    
  },
// ...

Thanks! ❤️

Thanks to:

For your contributions on the previous version of this addon :)

Contributing

Pull requests are welcome!

  • git clone this repository
  • npm install

Running tests

  • ember test OR
  • ember test --server

There’s a detailed test harness in the dummy app so please check that your changes work end-to-end by running that.

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.