Vuex

The LogRocket Vuex plugin logs Vuex mutations to the LogRocket console:

858

First, install with npm: npm i --save logrocket-vuex.

import createPlugin from 'logrocket-vuex';

const logrocketPlugin = createPlugin(LogRocket);

const store = new Vuex.Store({
  // ...
  plugins: [logrocketPlugin]
});

If you'd like to scrub sensitive data from mutations, or prevent some types of mutations from being logged, you can pass a sanitizer function as the second argument to createPlugin.

The sanitizer function should take mutation and return a new object to log. If the sanitizer returns null, the mutation will not be logged.

const logrocketPlugin = createPlugin(LogRocket, function(mutation) {
  if (mutation.type === 'SET_SECRET_TOKEN') {
    return null;
  }
  
  return mutation;
})
const logrocketPlugin = createPlugin(LogRocket, function(mutation) {
  if (mutation.type === 'SET_SECRET_TOKEN') {
    return {
      ...mutation,
      removeThisKey: undefined,
    };
  }
  
  return mutation;
})

🚧

Session Filtering

There currently is no way to filter over sessions containing a given Vuex mutation. They will appear as log entries in your sessions.