redux-logger
Advanced tools
Comparing version 2.0.5 to 2.1.0
@@ -89,7 +89,8 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
* @property {string} options.level - console[level] | ||
* @property {object} options.logger - implementation of the `console` API. | ||
* @property {bool} options.duration - print duration of each action? | ||
* @property {bool} options.timestamp - print timestamp with each action? | ||
* @property {object} options.colors - custom colors | ||
* @property {object} options.logger - implementation of the `console` API | ||
* @property {boolean} options.collapsed - is group collapsed? | ||
* @property {boolean} options.predicate - condition which resolves logger behavior | ||
* @property {bool} options.duration - print duration of each action? | ||
* @property {bool} options.timestamp - print timestamp with each action? | ||
* @property {function} options.stateTransformer - transform state before print | ||
@@ -96,0 +97,0 @@ * @property {function} options.actionTransformer - transform action before print |
@@ -25,7 +25,8 @@ "use strict"; | ||
* @property {string} options.level - console[level] | ||
* @property {object} options.logger - implementation of the `console` API. | ||
* @property {bool} options.duration - print duration of each action? | ||
* @property {bool} options.timestamp - print timestamp with each action? | ||
* @property {object} options.colors - custom colors | ||
* @property {object} options.logger - implementation of the `console` API | ||
* @property {boolean} options.collapsed - is group collapsed? | ||
* @property {boolean} options.predicate - condition which resolves logger behavior | ||
* @property {bool} options.duration - print duration of each action? | ||
* @property {bool} options.timestamp - print timestamp with each action? | ||
* @property {function} options.stateTransformer - transform state before print | ||
@@ -32,0 +33,0 @@ * @property {function} options.actionTransformer - transform action before print |
{ | ||
"name": "redux-logger", | ||
"version": "2.0.5", | ||
"version": "2.1.0", | ||
"description": "Logger for redux", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
# Logger for redux | ||
[![Build Status](https://travis-ci.org/fcomb/redux-logger.svg?branch=master)](https://travis-ci.org/fcomb/redux-logger) | ||
![logger](http://i.imgur.com/qhcz1OD.png) | ||
![redux-logger](http://i.imgur.com/LDgv4tp.png) | ||
@@ -35,2 +35,19 @@ ## Install | ||
#### __duration (Boolean)__ | ||
Print duration of each action? | ||
*Default: `false`* | ||
#### __timestamp (Boolean)__ | ||
Print timestamp with each action? | ||
*Default: `true`* | ||
#### __colors (Object)__ | ||
Object with 3 functions: `prevState`, `action`, `nextState`. Useful if you want paint message based on specific state or action. It also can be `null` if you want show plain message without colors. | ||
##### prevState = (getState: Function, action: Object) => (color: String) | ||
##### action = (getState: Function, action: Object) => (color: String) | ||
##### nextState = (getState: Function, action: Object) => (color: String) | ||
#### __logger (Object)__ | ||
@@ -41,3 +58,3 @@ Implementation of the `console` API. Useful if you are using a custom, wrapped version of `console`. | ||
#### __collapsed (getState: Function, action: Object): boolean__ | ||
#### __collapsed = (getState: Function, action: Object) => Boolean__ | ||
Takes a boolean or optionally a function that receives `getState` function for accessing current store state and `action` object as parameters. Returns `true` if the log group should be collapsed, `false` otherwise. | ||
@@ -47,3 +64,3 @@ | ||
#### __predicate (getState: Function, action: Object): boolean__ | ||
#### __predicate = (getState: Function, action: Object) => Boolean__ | ||
If specified this function will be called before each action is processed with this middleware. | ||
@@ -54,13 +71,3 @@ Receives `getState` function for accessing current store state and `action` object as parameters. Returns `true` if action should be logged, `false` otherwise. | ||
#### __duration (Boolean)__ | ||
Print duration of each action? | ||
*Default: `false`* | ||
#### __timestamp (Boolean)__ | ||
Print timestamp with each action? | ||
*Default: `true`* | ||
#### __transformer (Function)__ | ||
#### __stateTransformer = (state: Object) => state__ | ||
Transform state before print. Eg. convert Immutable object to plain JSON. | ||
@@ -70,3 +77,3 @@ | ||
#### __actionTransformer (Function)__ | ||
#### __actionTransformer = (action: Function) => action__ | ||
Transform action before print. Eg. convert Immutable object to plain JSON. | ||
@@ -79,6 +86,4 @@ | ||
```javascript | ||
const __DEV__ = true; | ||
createLogger({ | ||
predicate: (getState, action) => __DEV__ | ||
predicate: (getState, action) => process.env.NODE_ENV === `development` | ||
}); | ||
@@ -111,4 +116,5 @@ ``` | ||
createLogger({ | ||
transformer: (state) => { | ||
var newState = {}; | ||
stateTransformer: (state) => { | ||
let newState = {}; | ||
for (var i of Object.keys(state)) { | ||
@@ -121,2 +127,3 @@ if (Immutable.Iterable.isIterable(state[i])) { | ||
}; | ||
return newState; | ||
@@ -123,0 +130,0 @@ } |
@@ -14,7 +14,8 @@ const repeat = (str, times) => (new Array(times + 1)).join(str); | ||
* @property {string} options.level - console[level] | ||
* @property {object} options.logger - implementation of the `console` API. | ||
* @property {bool} options.duration - print duration of each action? | ||
* @property {bool} options.timestamp - print timestamp with each action? | ||
* @property {object} options.colors - custom colors | ||
* @property {object} options.logger - implementation of the `console` API | ||
* @property {boolean} options.collapsed - is group collapsed? | ||
* @property {boolean} options.predicate - condition which resolves logger behavior | ||
* @property {bool} options.duration - print duration of each action? | ||
* @property {bool} options.timestamp - print timestamp with each action? | ||
* @property {function} options.stateTransformer - transform state before print | ||
@@ -21,0 +22,0 @@ * @property {function} options.actionTransformer - transform action before print |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
23325
376
129
0