项目作者: benwinding

项目描述 :
Log actions & mutations in vuex! 🚀
高级语言: JavaScript
项目地址: git://github.com/benwinding/vuex-trace.git
创建时间: 2020-03-14T01:24:41Z
项目社区:https://github.com/benwinding/vuex-trace

开源协议:

下载


vuex-trace

NPM Version
License
Downloads/week
Github Issues
Build

Log actions & mutations in vuex! 🚀

screenshot

Usage

  1. // Default usage
  2. import { mutationLogger, actionLogger } from 'vuex-trace'
  3. const store = new Vuex.Store({
  4. state,
  5. mutations,
  6. plugins: [mutationLogger(), actionLogger()]
  7. })

Options

Options are based on the options from vuex’s built-in-logger-plugin

  1. // Mutation logger options
  2. mutationLogger({
  3. // Start with log group open
  4. collapsed: true,
  5. // Filter specific types of mutations
  6. filter: (mutation, stateBefore, stateAfter) => true,
  7. // Transform state during output
  8. transformer: state => state,
  9. // Transform mutation during output
  10. mutationTransformer: mut => mut,
  11. // Custom logger implementation
  12. logger: console
  13. })
  14. // Action logger options
  15. actionLogger({
  16. // Start with log group open
  17. collapsed: true,
  18. // Filter specific types of actions
  19. filter: (action, stateBefore, stateAfter) => true,
  20. // Transform state during output
  21. transformer: state => state,
  22. // Custom logger implementation
  23. logger: console
  24. })

Credit

This package was developed from the vuex default logger. And this PR.