Skip to content

Instantly share code, notes, and snippets.

@tusharmath
Created January 24, 2017 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tusharmath/4c930904075d3745d143b0c31e5135f1 to your computer and use it in GitHub Desktop.
Save tusharmath/4c930904075d3745d143b0c31e5135f1 to your computer and use it in GitHub Desktop.
Logs actions
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