Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sentry-node

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sentry-node

simple Node wrapper around Sentry API

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
254
decreased by-21.85%
Maintainers
3
Weekly downloads
 
Created
Source

Sentry-node

Node v0.10 compatible

Build Status

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>'
});

Note:

  • If SENTRY_DSN is not set or argument to Sentry is invalid, client will be disabled.
  • Argument to Sentry will update client settings even if SENTRY_DSN is set.

Error

sentry.error(err, message, logger, extra);
sample
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"
  }
);

image

arguments
  • 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);
sample
sentry.message(
  "message",
  "/trial.coffee",
  {
    note: "to test sentry-node api",
    type: "message"
  }
);

image

arguments
  • 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

Events

Sentry Client emits two events, logged and error that you can listen to.

client.on('logged', function(){
  console.log('Yay, it worked!');
});
client.on('error', function(e){
  console.log('oh well, Sentry is broke.');
  console.log(e);
})
client.message('Boom', 'logger');

Keywords

FAQs

Package last updated on 08 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc