Vue logger
文档(Document): English
适用于 vue 1.x 和 2.x
安装
npm install vue-logger --save
使用
引入
;Vue;
调用
{ // 当 shortname 为 true 时, 默认为true this; // 全局使用 Vueconsole; };
默认 levels ['log', 'warn', 'debug', 'error', 'dir']
, 你可以额外添加,
Vue; // 在组件中使用this;// log依旧可以使用this;
关于shortname
,默认是 true
,如果不想要别名,可以这么调用
this$console;
Options
Name | Type | Default | Desc |
---|---|---|---|
prefix | string | None | 日志前缀,可以通过 function 动态添加 |
dev | boolean | true | 日志开关,可选择在生产环境中关闭 |
shortname | boolean | true | |
levels | array | ['log', 'warn', 'debug', 'error', 'dir'] | |
forceLevels | array | [] | 无视 dev 的配置 强制打印 |
开发
# install deps npm install # build dist files npm run build # run all tests npm test
TODO
- sentry