LCOV - code coverage report
Current view: top level - src/store/modules - logger.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 6 6 100.0 %
Date: 2025-06-29 02:18:36 Functions: 4 4 100.0 %

          Line data    Source code
       1             : // @ts-check
       2             : import { BaseLogger as logger } from "@cern/base-vue";
       3             : 
       4             : class VuexLogger {
       5             :   constructor() {
       6           1 :     this.lastError = null;
       7             :   }
       8             : 
       9             :   /** @param {any} err */
      10             :   error(err) {
      11           2 :     if (err !== this.lastError) {
      12           1 :       this.lastError = err;
      13           1 :       logger.error(err);
      14             :     }
      15             :   }
      16             : }
      17             : 
      18             : /**
      19             :  * @param {import("vuex").Store<any>} store
      20             :  */
      21             : function plugin(store) {
      22           1 :   const vuexLogger = new VuexLogger();
      23           2 :   store.subscribeAction({ error(action, state, error) { vuexLogger.error(error); } });
      24             : }
      25             : 
      26             : export default plugin;

Generated by: LCOV version 1.16