Releases: LogRocket/redux-logger
Releases · LogRocket/redux-logger
3.0.6 — fixes
Changelog
- fix: use
Object.assign()
instead of object spread operator because non-standard feature #229 - fix: removed
babel: {}
options frompackage.json
- fix: remove dangling comma because non-standard feature #230
- fix: remove
module
andjsnext:main
properties frompackage.json
[BROKEN] 3.0.2 — chore: webpack → rollup
3.0.1 — fixed bug with custom titleFormatter
Changelog
- fix: ignore color formatting with custom titleFormatter (#216)
3.0.0 — breaking change with exports
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()
Changelog
- fix:
require()
was broken in 2.9.0+, now it fixed and works as expected (#210)
2.10.0 — improved readability
2.9.0 — default logger is back 🔥
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 customcolors
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
Now we throw error if logger
is not initialized via createLogger()
, thanks to @arbesfeld (#204)