GithubHelp home page GithubHelp logo

albertzak / meteor-raven Goto Github PK

View Code? Open in Web Editor NEW

This project forked from flowkey/meteor-raven

0.0 2.0 0.0 68 KB

Raven/Sentry integration package for Meteor

License: MIT License

JavaScript 100.00%

meteor-raven's Introduction

Raven

Raven/Sentry integration for Meteor. Includes Raven.js for frontend logging and raven-node for backend logging.

Provides consolidated error logging to Sentry via Raven from both the client and the server.

Although this is a fork of dVelopment/meteor-raven and deepwell/meteor-raven the API is completely differently!

Usage

Grab your client keys (DSN) from your project settings in Sentry. I recommend saving them in Meteor's setting.json:

  {
    // ...
    "sentryPrivateDSN": "https://[email protected]/app_id",
    "public": {
      // ...
      // public key has to be available from the client!
      "sentryPublicDSN": "https://public_key:[email protected]/app_id"
    }
  }

Now you can initialize the RavenLogger:

import { Meteor } from 'meteor/meteor';
import RavenLogger from 'meteor/flowkey:raven';

// ...

export const ravenLogger = new RavenLogger({
  publicDSN: Meteor.settings.public.sentryPublicDSN, // will be used on the client
  privateDSN: Meteor.settings.sentryPrivateDSN, // will be used on the server
  shouldCatchConsoleError: true, // default
  trackUser: false, // default
}, ravenOptions);

// ...

You can pass options for raven directly into the client. Which parameters are accepted can be found at the Sentry docs for the Node client and the JavaScript client. The options are being passed into both clients.

If you don't want to catch errors thrown globally or using console.error set shouldCatchConsoleError to false.

If you are using the Meteor Accounts package, you can enable user tracking on errors by settings trackUser to true. It will associate the error with the user's userId.

Now you can finally log messages to Sentry!

import { ravenLogger } from './path/to/logger';

// ...

ravenLogger.log('Error transmitted using Raven.captureMessage', additionalData);
ravenLogger.log(new Error('Error transmitted using Raven.captureException'), additionalData);

If the first argument is an instanceof Error then captureException from Raven is used, otherwise captureMessage. If an error is passed, Raven will be saving full error and exception stack traces.

additionalData can be anything described in the Sentry docs.

To set tags on the whole context, use ravenLogger.setTagsContext:

ravenLogger.setTagsContext({ component: 'system' });

meteor-raven's People

Contributors

bradwalton avatar dandv avatar deepwell avatar dvelopment avatar lightningboss avatar nerdmed avatar remarcable avatar rgould avatar thomasspiesser avatar

Watchers

 avatar  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.