deepwell / meteor-raven

Raven/Sentry integration package for Meteor
29 stars 10 forks source link

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.

This package is MIT Licensed. Do whatever you like with it but any responsibility for doing so is your own. All rights to raven are with the original authors.

Usage

Configure your client and server DSN keys and log an error message. For the client entry, don't include your private key. For the server entry, include your private key.

RavenLogger.initialize({
  client: 'https://public_key@app.getsentry.com/app_id',            // Do not include your private key here
  server: 'https://public_key:private_key@app.getsentry.com/app_id' // *DO* include your private key here
});
RavenLogger.log('Testing error message');

Optionally you can pass a tag:

RavenLogger.log('Testing error message', { component: 'system' });

If you are using the Meteor Accounts package, you can enable user tracking on errors:

RavenLogger.initialize({
  client: 'your client DSN here',
  server: 'your server DSN here'
}, {
  trackUser: true
});

To catch uncaught exceptions on the server, set patchGlobal to true or a function:

RavenLogger.initialize({
  client: 'your client DSN here',
  server: 'your server DSN here'
}, {
  patchGlobal: function() {
    console.log('Bye, bye, world');
    process.exit(1);
  }
});

Raven also works very well with saving full error and exception stack traces. Simply pass an Error or a Meteor.Error object to the log method to keep the stack trace.

RavenLogger.log(new Meteor.Error(422, 'Failed to save object to database'));