vuex-trace
v0.0.6
Published
Log actions & mutations in vuex! ๐
Downloads
267
Maintainers
Readme
vuex-trace
Log actions & mutations in vuex! ๐
Usage
// Default usage
import { mutationLogger, actionLogger } from 'vuex-trace'
const store = new Vuex.Store({
state,
mutations,
plugins: [mutationLogger(), actionLogger()]
})
Options
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
})
Credit
This package was developed from the vuex default logger. And this PR.