rollover
rollover
rollover
, is a hapi 17+ plugin used for Rollbar reporting.
Basic Usage
'use strict';const Hapi = ;const Rollover = ;const server = Hapi; await server; server;
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 theRollbar()
constructor. This option is required.reportErrorResponses
(Boolean) - Whentrue
, a hapionPreResponse
handler is created which sendsError
responses to Rollbar. Defaults totrue
.reportRequestLogs
(Boolean) - Whentrue
, a hapi'request'
event handler is created which sendsrequest.log()
data to Rollbar. The Rollbar report level can be controlled via therequest.log()
tags'critical'
,'error'
,'warning'
,'info'
, and'debug'
. If none of these tags are provided, Rollbar's default log level is used. Defaults totrue
.reportServerLogs
(Boolean) - Whentrue
, a hapi server'log'
event handler is created which sendsserver.log()
data to Rollbar. The Rollbar report level can be controlled via therequest.log()
tags'critical'
,'error'
,'warning'
,'info'
, and'debug'
. If none of these tags are provided, Rollbar's default log level is used. Defaults totrue
.silenceRollbarLogger
(Boolean) - Whentrue
, Rollbar'sconsole
logger is silenced. Defaults totrue
.exposedName
(String) -rollover
exposes aRollbar
instance, making it possible to implement custom usage throughout an application. By default, this instance is exposed on the hapi server asserver.plugins.rollover.rollbar
. This option allows the name to be changed to something other thanrollbar
.