npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rollbar-relay

v3.0.2

Published

A simple wrapper for Rollbar events.

Downloads

7

Readme

:satellite: rollbar-relay

rollbar-relay provides a small set of simple methods that you can use to easily send your application's exception and logging events to Rollbar.

Installation

Install with npm and save as a dependency:

npm install rollbar-relay --save

Require the module in your application:

const relay = require('rollbar-relay');

Configuration

rollbar-relay requires the ROLLBAR_POST_SERVER_ITEM_ACCESS_TOKEN environment variable to be set.

This token is listed in your Rollbar project's settings under Project Access Tokens.

Example

example.js exists in this module's directory that will send some example events to your Rollbar project.

Methods

critical(event, [custom], [request])

POSTs an event to Rollbar with a severity level of critical.

Arguments

  • event - The specific Error event that has occurred.
  • custom - (Optional) An Object containing custom data associated with the event.
  • request - (Optional) See: node_rollbar's docs regarding 'The Request Object'.

Example

var event = new Error('CRITICAL ERROR!');
var custom = {
  customErrorData: 'Everything is on fire.'
};

relay.critical(event, custom)

error(event, [custom], [request])

POSTs an event to Rollbar with a severity level of error.

Arguments

  • event - The specific Error event that has occurred.
  • custom - (Optional) An Object containing custom data associated with the event.
  • request - (Optional) See: node_rollbar's docs regarding 'The Request Object'.

Example

var event = new Error('An error has occurred in your application.');
var custom = {
  additionalData: 'String of useful information.'
};

relay.error(event, custom)

warning(event, [custom], [request])

POSTs an event to Rollbar with a severity level of warning.

Arguments

  • event - A String representing some sort of information related to activity in your application.
  • custom - (Optional) An Object containing custom data associated with the event.
  • request - (Optional) See: node_rollbar's docs regarding 'The Request Object'.

Example

var event = 'Warning: /index.html?foo=bar requested.';
var custom = {
  customString: 'Custom information.'
  customIdNumber: 123456
};
var request = {
  headers: {
    host: 'localhost',
    Authorization: 'Basic username:accessKey',
    Server: 'rollbar-relay Example Application'
  },
  protocol: 'https',
  url: 'https://locahost/index.html?foo=bar',
  method: 'GET',
  body: 'body',
  route: {
    path: 'home/index'
  }
};

relay.warning(event, custom, request)

info(event, [custom], [request])

POSTs an event to Rollbar with a severity level of info.

Arguments

  • event - A String representing some sort of information related to activity in your application.
  • custom - (Optional) An Object containing custom data associated with the event.
  • request - (Optional) See: node_rollbar's docs regarding 'The Request Object'.

Example

var event = `Refreshed data at: ${new Date()}`;
var custom = {
  refreshSize: 82917346
};

relay.info(event, custom)

debug(event, [custom], [request])

POSTs an event to Rollbar with a severity level of debug.

Arguments

  • event - A String representing some sort of information related to activity in your application.
  • custom - (Optional) An Object containing custom data associated with the event.
  • request - (Optional) See: node_rollbar's docs regarding 'The Request Object'.

Example

var event = 'Sync with OtherService returned a status code of 999.';
var custom = {
  debugCode: 999
};

relay.debug(event, custom)