2.1.1
Changelog
- deprecated:
transformeris deprecated, usestateTransformerinstead - feature:
colorsobject
Colors
We have so much requests (#91, #94 and other) about control over messages, so we bring it to life 🎉
Logger now have colors: Object option with 3 keys: prevState, action, nextState, each must return color as string (for example, red or #03A9F4).
prevState(prevState: Object) => color: Stringaction(action: Object) => color: StringnextState(nextState: Object) => color: String
colors also can be false if you don't need paint message or your env doesn't support console formatting (#92).
Examples
Disable colors
const logger = createLogger({
colors: false
});Paint action message with type AUTH_TOKEN_REMOVE to red
const logger = createLogger({
colors: {
prevState: () => `#9E9E9E`,
action: (action) => action.type === `AUTH_REMOVE_TOKEN` && `red`,
nextState: () => `#4CAF50`,
}
});