Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Rollbar is a real-time error tracking and monitoring tool for JavaScript applications. It helps developers to detect, diagnose, and fix errors in their applications by providing detailed error reports and notifications.
Error Tracking
Rollbar can automatically capture and report uncaught exceptions and unhandled promise rejections. This helps in tracking errors that occur in the application.
const Rollbar = require('rollbar');
const rollbar = new Rollbar({
accessToken: 'YOUR_ACCESS_TOKEN',
captureUncaught: true,
captureUnhandledRejections: true
});
// Example of tracking an error
try {
throw new Error('Test error');
} catch (e) {
rollbar.error(e);
}
Custom Logging
Rollbar allows custom logging of messages, warnings, and info messages. This can be useful for tracking specific events or conditions in the application.
const Rollbar = require('rollbar');
const rollbar = new Rollbar({
accessToken: 'YOUR_ACCESS_TOKEN'
});
// Log a custom message
rollbar.log('Custom log message');
// Log a warning
rollbar.warning('This is a warning');
// Log an info message
rollbar.info('This is an info message');
Telemetry
Rollbar can capture telemetry data such as console logs, network requests, and DOM events. This helps in understanding the context in which an error occurred.
const Rollbar = require('rollbar');
const rollbar = new Rollbar({
accessToken: 'YOUR_ACCESS_TOKEN',
captureUncaught: true,
captureUnhandledRejections: true,
autoInstrument: true
});
// Example of adding custom telemetry data
rollbar.configure({
payload: {
telemetry: [
{ type: 'log', level: 'info', body: 'Custom telemetry data' }
]
}
});
Sentry is another popular error tracking and monitoring tool. It provides similar functionalities to Rollbar, including real-time error tracking, performance monitoring, and detailed error reports. Sentry also supports a wide range of programming languages and frameworks.
Airbrake is an error monitoring tool that provides real-time error tracking and detailed error reports. It offers similar features to Rollbar, such as capturing uncaught exceptions and custom logging. Airbrake also integrates with various development tools and services.
Bugsnag is an error monitoring tool that helps developers to detect, diagnose, and fix errors in their applications. It provides similar functionalities to Rollbar, including real-time error tracking, custom logging, and detailed error reports. Bugsnag also offers features like user tracking and release tracking.
Generic library for reporting exceptions and other messages to Rollbar. Requires a Rollbar account.
##Quick start
// include and initialize the rollbar library with your access token
var rollbar = require("rollbar");
rollbar.init("POST_SERVER_ITEM_ACCESS_TOKEN");
// record a generic message and send to rollbar
rollbar.reportMessage("Hello world!");
Be sure to replace POST_SERVER_ITEM_ACCESS_TOKEN
with your project's post_server_item
access token, which you can find in the Rollbar.com interface.
Install using the node package manager, npm:
$ npm install --save rollbar
var express = require('express');
var rollbar = require('rollbar');
var app = express();
app.get('/', function(req, res) {
// ...
});
// Use the rollbar error handler to send exceptions to your rollbar account
app.use(rollbar.errorHandler('POST_SERVER_ITEM_ACCESS_TOKEN'));
app.listen(6943);
In your main application, require and initialize using your access_token::
var rollbar = require("rollbar");
rollbar.init("POST_SERVER_ITEM_ACCESS_TOKEN");
Other options can be passed into the init() function using a second parameter. E.g.:
// Queue up and report messages/exceptions to rollbar every 5 seconds
rollbar.init("POST_SERVER_ITEM_ACCESS_TOKEN", {handler: "setInterval", handlerInterval: 5});
When you are finished using rollbar, clean up any remaining items in the queue using the shutdown function:
rollbar.shutdown();
var options = {
// Call process.exit(1) when an uncaught exception occurs but after reporting all
// pending errors to Rollbar.
//
// Default: true
exitOnUncaughtException: true
};
rollbar.handleUncaughtExceptions("POST_SERVER_ITEM_ACCESS_TOKEN", options);
rollbar.init()
takes the following configuration options (pass in the second parameter):
Default: os.hostname()
Default: 'unspecified'
Default: setInterval
Default: 3
Default: 10
Default: 'https://api.rollbar.com/api/1/'
e.g. '/Users/bob/Development'
e.g. 'master'
e.g. '868ff435d6a480929103452e5ebe8671c5c89f77'
Default: ['passwd', 'password', 'secret', 'confirm_password', 'password_confirmation']
Contributions are welcome. The project is hosted on github at http://github.com/rollbar/node_rollbar
See the examples directory for more uses.
If you have any questions, feedback, etc., drop us a line at support@rollbar.com
FAQs
Effortlessly track and debug errors in your JavaScript applications with Rollbar. This package includes advanced error tracking features and an intuitive interface to help you identify and fix issues more quickly.
The npm package rollbar receives a total of 280,275 weekly downloads. As such, rollbar popularity was classified as popular.
We found that rollbar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.