Skip to content

Latest commit

 

History

History
76 lines (56 loc) · 2.21 KB

README_EN.md

File metadata and controls

76 lines (56 loc) · 2.21 KB

Vue logger

Ci Version License Downloads

It works with Vue.js 2.x and 1.x

Installation

NPM

npm install vue-logger --save

Usage

// ready
import vueLogger from "vue-logger";
Vue.use(vueLogger, {
  prefix: () => new Date(),
  dev: true,
  shortname: true,
  levels: ["log", "warn", "debug", "error", "dir"],
  forceLevels: []
});
// using
export default {
  ready() {
    // when shortname set true. the default value is true
    this.$error("hello world");

    // using in global
    Vue.console.log("hello world");
  }
};

the default level group are ['log', 'warn', 'debug', 'error', 'dir'], you can extends via parameter

Vue.use(vueLogger, { levels: ["info"] });

// using in instance
this.$info("hello world");

Options

Name Type Default Description
prefix string None The prefix can be dynamically generated
dev boolean true Log switch, selectable for shutdown in production environment
shortname boolean true
levels array ['log', 'warn', 'debug', 'error', 'dir']
forceLevels array [] some level would be displayed regardless of the dev option

Development Setup

# install deps
npm install

# build dist files
npm run build

# run all tests
npm test

TODO

  • sentry