Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Middleware that add redux state to the payload of Rollbar logs

License

Notifications You must be signed in to change notification settings

Syft-Application/redux-rollbar-state-middleware

Repository files navigation

Redux Rollbar State Middleware

Middleware that add redux state to the payload of Rollbar logs

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

Installation

npm install redux-rollbar-state-middleware --save
# or
yarn install redux-rollbar-state-middleware --save

Usage

import rollbarStateMiddleware from 'redux-rollbar-state-middleware'

const middleware = rollbarStateMiddleware(rollbar, options)

Options

Name Type Default Description
sanitizeState function - You can change the state before adding it to the Rollbar configuration

Example

import { createStore, applyMiddleware } from 'redux'
import rollbarStateMiddleware from 'redux-rollbar-state-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 = [
  rollbarStateMiddleware(rollbar)
];

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

You can find more usecases in the tests.

License

MIT

About

Middleware that add redux state to the payload of Rollbar logs

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published