Log actions & mutations in vuex! 🚀
Log actions & mutations in vuex! 🚀
// Default usage
import { mutationLogger, actionLogger } from 'vuex-trace'
const store = new Vuex.Store({
state,
mutations,
plugins: [mutationLogger(), actionLogger()]
})
Options are based on the options from vuex’s built-in-logger-plugin
// Mutation logger options
mutationLogger({
// Start with log group open
collapsed: true,
// Filter specific types of mutations
filter: (mutation, stateBefore, stateAfter) => true,
// Transform state during output
transformer: state => state,
// Transform mutation during output
mutationTransformer: mut => mut,
// Custom logger implementation
logger: console
})
// Action logger options
actionLogger({
// Start with log group open
collapsed: true,
// Filter specific types of actions
filter: (action, stateBefore, stateAfter) => true,
// Transform state during output
transformer: state => state,
// Custom logger implementation
logger: console
})
This package was developed from the vuex default logger. And this PR.