redux-logger#createLogger TypeScript Examples

The following examples show how to use redux-logger#createLogger. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: create-store.ts    From anthem with Apache License 2.0 6 votes vote down vote up
logger = createLogger({
  collapsed: true,
  duration: true,
  level: {
    prevState: false,
    action: "info",
    nextState: "info",
  },
  colors: {
    title: () => TITLE,
    action: () => ACTION,
    nextState: () => NEXT_STATE,
  },
})
Example #2
Source File: store.ts    From farrow with MIT License 6 votes vote down vote up
createReduxDevtoolsEnhancer = (devtools: boolean = true, name?: string, enableLogger = false) => {
  const composeEnhancers =
    // tslint:disable-next-line: strict-type-predicates
    devtools && typeof window === 'object' && (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
      ? (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
          name,
        })
      : compose

  const enhancer = enableLogger ? composeEnhancers(applyMiddleware(createLogger())) : composeEnhancers()

  return enhancer
}
Example #3
Source File: store.ts    From polkabtc-ui with Apache License 2.0 6 votes vote down vote up
configureStore = (): StoreState => {
  const storeLogger = createLogger();
  const state = loadState();
  const store = createStore(rootReducer, state, applyMiddleware(storeLogger));
  store.dispatch(initializeState(state));
  store.subscribe(() => {
    saveState(store.getState());
  });
  return store;
}
Example #4
Source File: configureAppStore.ts    From bob-extension with MIT License 6 votes vote down vote up
export default function configureAppStore() {
  return createStore(
    rootReducer,
    process.env.NODE_ENV !== 'production'
      ? applyMiddleware(thunk, createLogger({
        collapsed: (getState, action = {}) => [''].includes(action.type),
      }))
      : applyMiddleware(thunk),
  );
}
Example #5
Source File: configureStore.ts    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
export function configureStore() {
  const logger = createLogger({
    predicate: getState => {
      return getState().application.logActions;
    },
  });

  const middleware = process.env.NODE_ENV !== 'production' ? [toggleLogActionsMiddleware, thunk, logger] : [thunk];

  const store = reduxConfigureStore<StoreState>({
    reducer: createRootReducer(),
    middleware,
    devTools: process.env.NODE_ENV !== 'production',
    preloadedState: {
      navIndex: buildInitialState(),
    },
  });

  setStore(store);
  return store;
}
Example #6
Source File: index.ts    From shippo with MIT License 5 votes vote down vote up
{ stores, dispatch, thunkDispatch, selector } = createStore((...middleware) => {
  if (IS_DEV) {
    middleware.push(createLogger())
  }
  return composeWithDevTools(applyMiddleware(...middleware))
})
Example #7
Source File: index.ts    From shippo with MIT License 5 votes vote down vote up
{ stores, dispatch, thunkDispatch, selector } = createStore(
  (...middleware) => {
    if (IS_DEV) {
      middleware.push(createLogger())
    }
    return composeWithDevTools(applyMiddleware(...middleware))
  }
)
Example #8
Source File: index.ts    From selftrace with MIT License 5 votes vote down vote up
logger = createLogger({
  actionTransformer: ({ type, ...rest }: Action) => ({
    type: ActionType[type],
    ...rest,
  }),
})
Example #9
Source File: store.ts    From interbtc-ui with Apache License 2.0 5 votes vote down vote up
storeLogger = createLogger()
Example #10
Source File: configureStore.ts    From TabMerger with GNU General Public License v3.0 5 votes vote down vote up
logger = createLogger({
  collapsed: true,
  duration: true,
  predicate: () => process.env.NODE_ENV === "development"
})
Example #11
Source File: index.tsx    From pybricks-code with MIT License 5 votes vote down vote up
loggerMiddleware = createLogger({ predicate: () => false })
Example #12
Source File: index.ts    From Covid19 with MIT License 5 votes vote down vote up
store = createStore(persistedReducer, applyMiddleware(createLogger()))