It works with Vue.js 2.x and 1.x
npm install vue-logger --save
// 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");
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 |
# install deps
npm install
# build dist files
npm run build
# run all tests
npm test
- sentry