redux-logdown

raw JSON →
1.0.4 verified Sat Apr 25 auth: no javascript

A Redux logger middleware built on top of logdown, providing localStorage.debug support for enabling/disabling store logging. Current stable version is 1.0.4. Released as needed for minor fixes. Key differentiator from redux-logger: native localStorage.debug integration for toggling logging without code changes. Uses logdown for colorful, grouped console output with optional diff display.

error TypeError: reduxLogdown is not a function
cause Using named import instead of default import in ESM.
fix
Use 'import reduxLogdown from 'redux-logdown' instead of 'import { reduxLogdown } from 'redux-logdown'
error Error: Could not find module 'logdown'
cause Missing dependency logdown; redux-logdown lists it as a dependency but sometimes install fails.
fix
Run 'npm install logdown' or 'yarn add logdown'
error Uncaught TypeError: Cannot read property 'apply' of undefined
cause Applying middleware incorrectly, e.g., passing middleware instance where function expected.
fix
Correct usage: applyMiddleware(reduxLogdown('namespace'))
gotcha Logging disabled by default unless localStorage.debug is set for the namespace.
fix Set localStorage.debug = 'myStore' in browser console or configure at runtime.
gotcha The middleware function expects a string namespace and an options object; passing incorrect arguments may cause runtime errors.
fix Ensure first argument is a string and second is an object with diff boolean.
deprecated Package is based on logdown, which is no longer actively maintained.
fix Consider migrating to redux-logger or other actively maintained loggers.
npm install redux-logdown
yarn add redux-logdown
pnpm add redux-logdown

Shows basic Redux setup with redux-logdown middleware that logs actions and state diff.

import { createStore, applyMiddleware } from 'redux';
import reduxLogdown from 'redux-logdown';

const logger = reduxLogdown('myStore', { diff: true });
const store = createStore(
  (state = { count: 0 }, action) => {
    switch (action.type) {
      case 'INCREMENT':
        return { count: state.count + 1 };
      default:
        return state;
    }
  },
  applyMiddleware(logger)
);

store.dispatch({ type: 'INCREMENT' });