Code Monkey home page Code Monkey logo

rollover's Introduction

rollover

Current Version Build Status via Travis CI Dependencies belly-button-style

rollover

rollover, is a hapi 17+ plugin used for Rollbar reporting.

Basic Usage

'use strict';
const Hapi = require('hapi');
const Rollover = require('rollover');
const server = Hapi.server();

await server.register([
  { plugin: Rollover, options: { rollbar: your_rollbar_token } }
]);

server.route([
  {
    method: 'GET',
    path: '/foo',
    handler (request, h) {
      request.log(['log'], 'request.log() -> rollbar.log()');
      request.log(['log', 'error'], 'request.log() -> rollbar.error()');
      throw new Error('throw_err');
    }
  }
]);

Live Testing

By default rollover's test suite mocks calls to the Rollbar service. To make real Rollbar calls in the test suite, use the following command:

ROLLOVER_ROLLBAR_TOKEN=your_rollbar_token npm test

Plugin Options

rollover supports the following configuration options during plugin registration.

  • rollbar - Rollbar configuration that is passed directly to the Rollbar() constructor. This option is required.
  • reportErrorResponses (Boolean) - When true, a hapi onPreResponse handler is created which sends Error responses to Rollbar. Defaults to true.
  • reportRequestLogs (Boolean) - When true, a hapi 'request' event handler is created which sends request.log() data to Rollbar. The Rollbar report level can be controlled via the request.log() tags 'critical', 'error', 'warning', 'info', and 'debug'. If none of these tags are provided, Rollbar's default log level is used. Defaults to true.
  • reportServerLogs (Boolean) - When true, a hapi server 'log' event handler is created which sends server.log() data to Rollbar. The Rollbar report level can be controlled via the request.log() tags 'critical', 'error', 'warning', 'info', and 'debug'. If none of these tags are provided, Rollbar's default log level is used. Defaults to true.
  • silenceRollbarLogger (Boolean) - When true, Rollbar's console logger is silenced. Defaults to true.
  • exposedName (String) - rollover exposes a Rollbar instance, making it possible to implement custom usage throughout an application. By default, this instance is exposed on the hapi server as server.plugins.rollover.rollbar. This option allows the name to be changed to something other than rollbar.

rollover's People

Contributors

cjihrig avatar arb avatar

Stargazers

James Wragg avatar Peter Banjo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.