redux-logger

Redux middleware that logs every dispatched action to the console with previous and next state snapshots.

Library
npm
v3.0.6
5,710 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
50 /100 Fair
Development Activity 0
Maintenance 32
Community 68
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
60 /100 Good
Architecture 68
Code Quality 65
Innovation 45
Learning Curve 60

redux-logger is a small Redux middleware that intercepts every dispatched action and prints a grouped console entry showing the action itself alongside the store’s previous and next state. It ships as a drop-in default export for zero-config setups (import logger from 'redux-logger') and a createLogger(options) factory for customized behavior, and is applied like any other Redux middleware via applyMiddleware.

Beyond the basics, it supports collapsible log groups, per-section console levels (log/warn/error/info), custom color theming, timestamp/duration display, predicate-based filtering to skip specific actions, and optional state diffing (via the bundled deep-diff dependency). Transform hooks (stateTransformer, actionTransformer, errorTransformer) let it print non-plain state shapes, such as Immutable.js structures, in readable form.

The project is functionally complete for its scope and has been stable for years, but development activity is low today (last commit 2020, per GitHub) — it is a mature, largely feature-frozen utility rather than an actively evolving one. It remains widely installed as the default way to eyeball Redux action/state flow during development without a browser devtools extension.

What You Get

  • A createLogger(options) factory plus a zero-config default export for immediate use with applyMiddleware
  • Grouped console output per action showing prevState, the action, any thrown error, and nextState
  • Optional collapsible groups (collapsed) and inline state diffing (diff) to reduce console noise
  • Configurable console level (log/warn/error/info) per log section, as a string, object, or function of the action
  • Predicate-based filtering (predicate) to skip logging for specific actions or state conditions
  • Transform hooks (stateTransformer/actionTransformer/errorTransformer) for non-plain state such as Immutable.js

Common Use Cases

  • Wiring logger into applyMiddleware during local development to watch every action/state transition in the browser console
  • Gating the middleware behind NODE_ENV === 'development' so it never ships to production bundles
  • Using predicate to silence high-frequency or sensitive actions (e.g. auth token actions) while logging everything else
  • Enabling diff: true to see exactly which state keys changed after a suspect action, for regression debugging
  • Using stateTransformer to convert Immutable.js records to plain JSON before printing, per the documented recipe

Under The Hood

Architecture The package is small and purely functional, split across index.js (the createLogger middleware factory and a default-export back-compat wrapper), core.js (printBuffer, which formats one console group per buffered action), diff.js (a deep-diff-based state-diff renderer), helpers.js (timer/time-formatting utilities), and defaults.js (the flat default-options object). createLogger returns the actual Redux middleware ({ getState }) => next => action => {...} and defensively detects a common misuse — passing createLogger itself directly to applyMiddleware instead of calling it first — printing an actionable console error rather than failing silently. Configuration flows entirely through a flat options object merged over defaults; there is no plugin system or dependency injection, and the logBuffer array is filled and drained synchronously within a single dispatch, so there is no cross-dispatch batching despite the buffer abstraction.

Tech Stack Plain ES2015+ JavaScript, compiled with Babel (babel-preset-es2015) and bundled via Rollup (rollup.config.js) into both CommonJS (dist/redux-logger.js) and ES module (dist/redux-logger.es.js) outputs, then minified with uglify-js. The only runtime dependency is deep-diff, used for the optional diff view. There is no TypeScript in the source — type definitions are published separately via DefinitelyTyped’s @types/redux-logger, per the README. Tests run on Mocha, Chai, and Sinon under nyc for coverage, with codecov upload wired into a CircleCI pipeline (Node 8 image); linting uses ESLint with the airbnb config. The tooling (Rollup config style, Node 8 CI image) reflects the package’s 2015-2017 origins.

Code Quality Three spec files (spec/index.spec.js, spec/diff.spec.js, spec/helpers.spec.js) cover the middleware, diff renderer, and helpers, run via npm run spec behind npm test, which also runs lint first. Error handling in the middleware is deliberate: an error thrown while processing a dispatched action is caught, passed through errorTransformer, logged, then re-thrown so calling code and browser devtools still observe the original failure. Console-grouping calls are wrapped in try/catch with fallbacks (logger.groupEnd() falls back to a plain logger.log line) for environments with partial console support. There is no static typing in the source itself. CI (CircleCI) runs lint and tests on every push, though the project’s last commit was in 2020 and it is now largely feature-frozen.

API Design The public surface is intentionally minimal: a single createLogger(options) factory returning a standard middleware, plus a default export that works with zero configuration for the common case (import logger from 'redux-logger'). Every customization point (level, colors, stateTransformer, predicate, diff, etc.) is an optional key merged over sane defaults, so adopting one feature requires no other changes. Getting started takes one import and one line inside applyMiddleware, though the tradeoff is a fairly large flat options surface once non-default behavior is needed, and TypeScript types are not bundled with the package itself.

Used by 5 apps in this directory

JavaScript
99%
Other

ChartBrew

Analytics · Databases

4,063

Open-source reporting platform to build live dashboards from SQL, NoSQL, APIs, and SaaS tools with an AI assistant that creates charts from natural language.

View details
90
Repo Health
83
Technical
64
Dependency
Built with
JavaScript 99%
Updated 1 weeks ago
TypeScript
84%
Apache 2.0

Continue

AI Code Assistants · AI Development · Automation

36,049

Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.

View details
73
Repo Health
88
Technical
62
Dependency
Built with
TypeScript 84%
Updated 5 days ago
Go
50%
Apache 2.0

opencloud

File Storage

6,073

Open source file management and collaboration platform that keeps your data under your control, no database required.

View details
85
Repo Health
80
Technical
68
Dependency
Built with
Go 50%
Gherkin 34%
PHP 12%
Updated 1 weeks ago
TypeScript
97%
AGPL 3.0

Responsively App

Design Tools · Developer Tools

25,201

Preview and interact with your responsive web design across every device size simultaneously — no more manual resizing.

View details
78
Repo Health
71
Technical
67
Dependency
Built with
TypeScript 97%
Updated 1 weeks ago
JavaScript
75%
AGPL 3.0

Twake Drive

Collaboration · File Storage

987

Open-source, self-hosted file manager with collaborative drives, AI-powered summarization, and OnlyOffice document editing for teams who want full data sovereignty.

View details
90
Repo Health
78
Technical
72
Dependency
Built with
JavaScript 75%
TypeScript 24%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers