How to use redux-logger - 10 common examples

To help you get started, we’ve selected a few redux-logger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Caltech-IPAC / firefly / src / firefly / js / core / ReduxFlux.js View on Github external
//     if (type.startsWith('ReadoutCntlr')) return false;
//     return window.enableFireflyReduxLogging;
// }

function logFilter(getState,action) {
    return window.enableFireflyReduxLogging;
}


function collapsedFilter(getState,action) {
    return collapsedLogging.includes(action.type);
}


// eslint-disable-next-line
const logger= createLogger({duration:true, predicate:logFilter, collapsed:collapsedFilter}); // developer can add for debugging


function createRedux() {
    // create a rootReducer from all of the registered reducers
    const rootReducer = combineReducers(reducers);
    const sagaMiddleware = createSagaMiddleware();
    const middleWare=  applyMiddleware(thunkMiddleware, logger, sagaMiddleware); //todo: turn off action logging
    const store = createStore(rootReducer, middleWare);
    sagaMiddleware.run(masterSaga);
    return store;
}

function startCoreSagas() {
    dispatchAddSaga( imagePlotter);
    dispatchAddSaga( watchReadout);
    dispatchAddSaga( watchForRelatedActions);
github simpleweb / romulus-cli / generators / base / templates / App / Store / Middleware / Logger.js View on Github external
// @flow
import { createLogger } from 'redux-logger';

const blacklist = [
  // If you wish to remove actions from the
  // logger, they should be added here
];

const Logger = createLogger({
  predicate: (getState, action) => !blacklist.includes(action.type)
});

module.exports = Logger;
github web-pal / chronos-timetracker / app / store / configureStore.development.js View on Github external
import { createStore, applyMiddleware, compose } from 'redux';
import { createLogger } from 'redux-logger';
import createSagaMiddleware, { END } from 'redux-saga';

import rootReducer from '../reducers';
import config from '../config';

const logger = createLogger({
  level: 'info',
  collapsed: true,
});

/* eslint-disable no-underscore-dangle */
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
/* eslint-enable */


export default function configureStore(initialState) {
  const sagaMiddleware = createSagaMiddleware();
  const middlewares = [
    sagaMiddleware,
    config.reduxLogger && logger,
  ].filter(Boolean);
  const enhancer = composeEnhancers(
github xiaoyunyang / react-native-travel-app / index.ios.js View on Github external
AppRegistry,
} from 'react-native';

import { Provider } from 'react-redux';
import { createStore, applyMiddleware, combineReducers, compose} from 'redux';
import thunkMiddleware from 'redux-thunk';
import { createLogger } from 'redux-logger';
import reducers from './app/reducers'
import AppContainer from './app/containers/AppContainer'

//Redux Storage imports. AsyncStorage is the Storage Engine
import {persistStore, autoRehydrate} from 'redux-persist'
import {AsyncStorage} from 'react-native'

//define logger middleware: set logger for only development mode
const loggerMiddleware = createLogger({ predicate: (getState, action) => __DEV__ });

function configureStore(initialState) {
  //more boilerplate. Enhancer composes different middleware
  const enhancer = compose(
    autoRehydrate(),
    applyMiddleware(
      thunkMiddleware,
      loggerMiddleware,
    ),
  );
  return createStore(reducers, initialState, enhancer);
}

const store = configureStore({});

/*  Enable PersistStore by uncommenting below */
github prsn / redux-persist-sqlite-storage / examples / rn / ReduxPersistSQLiteExample / store.js View on Github external
import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
import { persistStore, autoRehydrate } from 'redux-persist'
import {createLogger} from 'redux-logger';
import thunk from 'redux-thunk';
import todoReducer from './reducers/todo-reducers';
// import storage from 'redux-persist/lib/storage';
import SQLite from 'react-native-sqlite-storage';
import SQLiteStorage from 'redux-persist-sqlite-storage';

const storeEngine = SQLiteStorage(SQLite);
// import logger from 'redux-logger';
const logger = createLogger({
  collapsed: true,
  duration: true,
  logErrors: true
});

SQLite.DEBUG(true);
SQLite.enablePromise(true);


const persistConfig = {
  storage: storeEngine,
  debug: true
};
// const persistedReducer = persistReducer(persistConfig, todoReducer);
// let store = createStore(persistedReducer, {}, applyMiddleware([thunk, logger]));
github Logistics21 / ReadTheLeaves / frontend / store / store.js View on Github external
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from '../reducers/root_reducer';

const middlewares = [thunk];

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
if (process.env.NODE_ENV !== 'production') {
  // must use 'require' (import only allowed at top of file)
  const { createLogger } = require('redux-logger');
  middlewares.push(createLogger());
}

const configureStore = (preloadedState = {}) => {
  return (
    createStore(
      rootReducer,
      preloadedState,
      composeEnhancers(
      applyMiddleware(...middlewares)
    ))
  )
};

export default configureStore;
github maidsafe / safe_examples / email_app / app / store / configureStore.development.js View on Github external
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import createLogger from 'redux-logger';
import { hashHistory } from 'react-router';
import { routerMiddleware, push } from 'react-router-redux';
import rootReducer from '../reducers';
import { CONSTANTS } from '../constants';
import promiseMiddleware from 'redux-promise-middleware';


const actionCreators = {
  // ...counterActions,
  push,
};

const logger = createLogger({
  level: 'info',
  collapsed: true,
});

const router = routerMiddleware(hashHistory);


const enhancer = compose(
  applyMiddleware(thunk, router, logger, promiseMiddleware({
    promiseTypeSuffixes: ['LOADING', 'SUCCESS', 'ERROR']
  })),
  window.devToolsExtension ?
    window.devToolsExtension({ actionCreators }) :
    noop => noop
);
github Margatroid / micro-dashboard / app / app.js View on Github external
import { IndexRoute, Route } from 'react-router'
import Layout from './layout'
import Explorer from './containers/explorer'
import Query from './containers/query'
import Service from './components/service'
import InjectTapEventPlugin from 'react-tap-event-plugin'
import thunkMiddleware from 'redux-thunk'
import createLogger from 'redux-logger'

import rootReducer from './reducers'
import { createStore, compose, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import { ReduxRouter, reduxReactRouter } from 'redux-router'
import { createHistory } from 'history'

const loggerMiddleware = createLogger()

const store = compose(
                applyMiddleware(thunkMiddleware, loggerMiddleware),
                reduxReactRouter({ createHistory })
              )(createStore)(rootReducer)

// Needed for onTouchTap
// Can go away when react 1.0 release
// Check this repo:
// https://github.com/zilverline/react-tap-event-plugin
InjectTapEventPlugin()

ReactDOM.render(
  <div>
    
      </div>
github omnidan / redux-undo-boilerplate / src / store / configureStore.js View on Github external
/* global __DEVTOOLS__ */
import { createStore, applyMiddleware, compose } from 'redux'
// reducer
import rootReducer from '../reducers'
// middleware
import thunkMiddleware from 'redux-thunk'
import promiseMiddleware from 'redux-promise'
import createLogger from 'redux-logger'

const loggerMiddleware = createLogger({
  level: 'info',
  collapsed: true
})

const enforceImmutableMiddleware = require('redux-immutable-state-invariant')()

let createStoreWithMiddleware

if (typeof __DEVTOOLS__ !== 'undefined' && __DEVTOOLS__) {
  const { persistState } = require('redux-devtools')
  const DevTools = require('../containers/DevTools')
  createStoreWithMiddleware = compose(
    applyMiddleware(
      enforceImmutableMiddleware,
      thunkMiddleware,
      promiseMiddleware,
github auth0 / auth0-management-api-webhooks / client / store / configureStore.js View on Github external
export default function configureStore() {
  const pipeline = [
    applyMiddleware(
      promiseMiddleware(),
      thunkMiddleware,
      normalizeErrorMiddleware(),
      createLogger({
        predicate: () => process.env.NODE_ENV !== 'production'
      })
    )
  ];

  if (process.env.NODE_ENV !== 'production') {
    pipeline.push(DevTools.instrument());
  }

  const finalCreateStore = compose(...pipeline)(createStore);
  const store = finalCreateStore(rootReducer, { });

  // Enable Webpack hot module replacement for reducers.
  if (nextRootReducer) {
    module.hot.accept('../reducers', () => {
      store.replaceReducer(nextRootReducer);

redux-logger

Logger for Redux

MIT
Latest version published 8 years ago

Package Health Score

70 / 100
Full package analysis