停止维护,建议使用 eruda
vue的一个插件,主要用于在移动应用开发测试阶段记录日志,并提供界面实时查看。使用localstorage存储日志。
npm install vue-logconsole
// main.js
import Vue from 'vue'
import logConsole from 'vue-logconsole'
Vue.use(logConsole, {
maxSize: 2 * 1024 * 1024, // 默认占用localstorage 1M空间
threshold: -1 // 级别小于该值的日志不会被记录,{debug: 0, info: 1, warn: 2, error: 3}。生产环境不记录日志可设置值为999
})
Vue.Logger.debug('test', '测试')
// App.vue; 点击close按钮时触发 @close-log-page 事件
<log-console :show=true @close-log-page="closeLogPage"></log-console>
- Vue.Logger.debug('tag', 'content')
记录debug日志,级别为0 - Vue.Logger.info('tag', 'content')
记录info日志,级别为1 - Vue.Logger.warn('tag', 'content')
记录warn日志,级别为2 - Vue.Logger.error('tag', 'content')
记录error日志,级别为3