Skip to content

Instantly share code, notes, and snippets.

@hypest
Last active May 17, 2022 14:40
Show Gist options
  • Save hypest/9c8facebc1655122934778ec7d721860 to your computer and use it in GitHub Desktop.
Save hypest/9c8facebc1655122934778ec7d721860 to your computer and use it in GitHub Desktop.
Gutenberg Redux action logger
function createSimpleLogger( storeName ) {
return ( store ) => ( next ) => ( action ) => {
const result = next( action );
console.log( {
storeName,
action,
result,
} );
return result;
};
}
// Then in instantiateReduxStore, add to middlewares
function instantiateReduxStore( key, options, registry, thunkArgs ) {
...
const middlewares = [
...
createSimpleLogger( key ),
];
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment