Skip to content

Releases: LogRocket/redux-logger

3.0.6 — fixes

17 May 14:37
Compare
Choose a tag to compare

Changelog

  • fix: use Object.assign() instead of object spread operator because non-standard feature #229
  • fix: removed babel: {} options from package.json
  • fix: remove dangling comma because non-standard feature #230
  • fix: remove module and jsnext:main properties from package.json

[BROKEN] 3.0.2 — chore: webpack → rollup

17 May 11:09
Compare
Choose a tag to compare

UPD: broken because #229

Internal build tools updates.

Changelog

  • webpack → rollup (#227)

3.0.1 — fixed bug with custom titleFormatter

30 Mar 17:41
Compare
Choose a tag to compare

Changelog

  • fix: ignore color formatting with custom titleFormatter (#216)

3.0.0 — breaking change with exports

23 Mar 13:38
Compare
Choose a tag to compare

Breaking change

In 2.9.0 we introduced default logger, but this led to problems (#210).

It was so bad that we publish 3 broken versions. So, we decided made a breaking change: by default we now export logger with default options and createLogger is now coming as named import.

TL;DR

You need to change your import

import { applyMiddleware, createStore } from 'redux'

- import createLogger from 'redux-logger'
+ import { createLogger } from 'redux-logger'
// or
- var createLogger = require('redux-logger')
+ var createLogger = require('redux-logger').createLogger

const logger = createLogger()

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

or use logger with default settings

import { applyMiddleware, createStore } from 'redux'
import logger from 'redux-logger'
// or const { logger } = require('redux-logger')

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

2.10.2 — fixed require()

21 Mar 21:42
Compare
Choose a tag to compare

Changelog

  • fix: require() was broken in 2.9.0+, now it fixed and works as expected (#210)

2.10.0 — improved readability

21 Mar 13:26
Compare
Choose a tag to compare

Thankfully to @lestad and Russian-speaking @react_js community in Telegram now we have better readability (#209)

Now

Before

2.9.0 — default logger is back 🔥

21 Mar 11:55
Compare
Choose a tag to compare

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`;
    }
  }
})

2.8.2 — error if passed createLogger to middleware

02 Mar 10:39
Compare
Choose a tag to compare

Now we throw error if logger is not initialized via createLogger(), thanks to @arbesfeld (#204)

image

2.8.1 — action.type implicitly converts to string

02 Feb 14:32
Compare
Choose a tag to compare

Remember this recipe?

import createLogger from 'redux-logger';

const logger = createLogger({
  actionTransformer: (action) => ({
    ...action,
    type: String(action.type),
  })
});

No more!

Changelog

  • feat: implicitly convert action.type to String() in console.log (#195, #194, #106, #129, #128, #14, etc)

2.8.0 — logEntry in `collapsed` option and no more [object Object] in diff

01 Feb 12:39
Compare
Choose a tag to compare

Changelog

  • feat: add logEntry param in collapsed option (#200)
  • fix: don't stringify output in diff (#182)