0.1.1 • Published 7 years ago

redux-rollbar-telemetry-middleware v0.1.1

Weekly downloads
36
License
MIT
Repository
github
Last release
7 years ago

Redux Rollbar Telemetry Middleware

Middleware that helps to add redux action to the Rollbar.Telemetry

Note: lib/ is in repo until we publish package on npm

Usage

const middleware = rollbarTelemetryMiddleware(rollbar, options)

Options

NameTypeDefaultDescription
errorLogTypestringwarningRollbar log type. "critical", "error", "warning", "info" or "debug"
defaultLogTypestringdebugRollbar log type. "critical", "error", "warning", "info" or "debug"
patternstring|array|function|RegExpaccept all actionsUsing pattern you can filter the action, that you want to log to the breadcrumbs
transformationsArray[TransformationObject]-Transformation will be applied to the action before the capture. It is useful if you want to omit some data from the actions
TransformationObject
NameTypeDefaultDescription
patternstring|array|function|RegExp-Pattern to filter the action that we want to transform
transformationfunction-Transformation function

Transformation function receive the arguments:

  • action - original action or the action from the previous transformation if this action matches to the several transformations

Example

import { createStore, applyMiddleware } from 'redux'
import rollbarTelemetryMiddleware from 'lib/redux-rollbar-telemetry-middleware'

import Rollbar from 'rollbar' // server usage. for client use the instruction https://rollbar.com/docs/notifier/rollbar.js/#umd--browserify--requirejs--webpack

const rollbar = new Rollbar({ /* ... some config */ })

const middleware = [
  rollbarTelemetryMiddleware(rollbar)
];

export const store = createStore(
  appReducers,
  composeWithDevTools(
    applyMiddleware(...middleware),
  )
)

You can find more usecases in the tests.

License

MIT