Sentry-node
Node v0.10 compatible
A simple Node wrapper around Sentry API.
Installation
$ npm install sentry-node
Testing
$ npm test
Usage
Creating the Client
var Sentry = require('sentry-node');
You can intialize sentry-node
by passing in a Sentry DSN:
var sentry = new Sentry('<your Sentry DSN>');
Or you can set it as an process.env
variable:
var sentry = new Sentry();
You can also pass in the config parameters as an object:
var sentry = new Sentry({
key: '<your sentry public key>',
secret: '<your sentry secret key>',
project_id: '<your sentry project id>'
});
Error
sentry.error(err, message, logger, extra);
arguments
sentry.error(new Error("The error method expected an Error instance as first argument."), "Bad arguments to sentry-node:error method", '/sentry-node.coffee', {note: "to test sentry-node error method", version: "0.1.0"});
- err: must be an instance of
Error
, err.message
will be used for the smaller text that appears right under culprit
- message:
culprit
, big text that appears at the top - logger: the name of the logger which created the record, should be the error logger/handler in your code
- extra: (optional) an object gives more context about the error in addition to
err.stack
Message
sentry.message(message, logger, extra);
arguments
sentry.message("message", "/trial.coffee", {note: "to test sentry-node api", type: "message"});
- message: text will be used for both the big text appears at the top and the smaller text appears right under it
- logger: the name of the logger which created the record
- extra: (optional) an object gives more context about the message