Created
January 24, 2017 05:43
-
-
Save tusharmath/4c930904075d3745d143b0c31e5135f1 to your computer and use it in GitHub Desktop.
Logs actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function logger (action: any, state0: any, state1: any, effect: any) { | |
if (!getGlobalConfig().dispatcherLogs) return | |
let actionName: string[] = [] | |
while (action instanceof Action) { | |
actionName.push(action.type) | |
action = action.value | |
} | |
console.groupCollapsed(actionName.join('/')) | |
console.log('ACTION', action) | |
console.log('EFFECT', effect) | |
console.log('PREV', state0) | |
console.log('NEXT', state1) | |
console.groupEnd() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment