yarn redux-logger 2.9.0
2.9.0 — default logger is back 🔥

latest releases: 4.0.0, 3.0.6, 3.0.5...
7 years ago

It's more friendly for newcomers and now recommended way to use redux-logger.

So, you can import default logger and use it with default options:

import { logger } from 'redux-logger'

const store = createStore(
  reducer,
  applyMiddleware(logger)
)

Changelog

  • expose default logger (import { logger } from 'redux-logger)
  • expose default settings (import { defaults } from 'redux-logger): useful if you use custom colors object and tired type default settings.

Instead of

import createLogger from 'redux-logger'

const logger = createLogger({
  colors: {
    prevState: () => `#9E9E9E`,
    action: () => `#03A9F4`,
    nextState: () => `#4CAF50`,
    error: () => `#F20404`,
    title: ({ type }) => {
      if (type.indexOf(`started`) > -1) return `orange`;
      if (type.indexOf(`failed`) > -1) return `#F20404`;
      if (type.indexOf(`succeeded`) > -1) return `#4CAF50`;
      if (type.indexOf(`update`) > -1) return `#03A9F4`;

      return `inherit`;
    }
  }
})

you can

import createLogger, { defaults } from 'redux-logger'

const logger = createLogger({
  colors: {
    ...defaults.colors,
    title: ({ type }) => {
      if (type.indexOf(`started`) > -1) return `orange`;
      if (type.indexOf(`failed`) > -1) return `#F20404`;
      if (type.indexOf(`succeeded`) > -1) return `#4CAF50`;
      if (type.indexOf(`update`) > -1) return `#03A9F4`;

      return `inherit`;
    }
  }
})

Don't miss a new redux-logger release

NewReleases is sending notifications on new releases.