vuex-trace

Log actions & mutations in vuex! 🚀

Usage no npm install needed!

<script type="module">
  import vuexTrace from 'https://cdn.skypack.dev/vuex-trace';
</script>

README

vuex-trace

NPM Version License Downloads/week Github Issues Build

Log actions & mutations in vuex! 🚀

screenshot

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.