Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.
/ vue-logconsole Public archive

vue的一个插件,主要用于在移动应用开发测试阶段记录日志,并提供界面实时查看。

Notifications You must be signed in to change notification settings

hughfenghen/vue-logconsole

Repository files navigation

停止维护,建议使用 eruda

vue-logconsole

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>

功能预览

记录日志

按关键字过滤日志

按等级过滤日志

API

  • 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

About

vue的一个插件,主要用于在移动应用开发测试阶段记录日志,并提供界面实时查看。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published