1.0.3 • Published 6 years ago
bunyan-rollbar-stream v1.0.3
bunyan-rollbar-stream
Bunyan stream for sending Rollbar
Install
With NPM
npm install --save bunyan-rollbar-stream
Usage
import Rollbar from 'rollbar'
import bunyan from 'bunyan'
import BunyanRollbarStream from 'bunyan-rollbar-stream'
var rollbar = new Rollbar({
accessToken: 'MY-ROLLBAR-ACCESS-TOKEN',
})
var log = bunyan.createLogger({
name: 'my-app',
serializers: bunyan.stdSerializers,
streams: [
{
name: 'rollbar',
stream: new BunyanRollbarStream({
rollbar: rollbar
}),
level: 'error'
}
]
})
// This line will automatically sends error to Rollbar
log.error({ err: new Error('Error') }, 'Some error occurred')