qq.setEnableDebug(Object object)

参数

Object object

示例代码

Tips

  • 在正式版打开调试还有一种方法,就是先在开发版或体验版打开调试,再切到正式版就能看到vConsole。

LogManager qq.getLogManager(Object object)

获取日志管理器对象。

参数

Object object
属性类型默认值必填说明最低版本
levelnumber0取值为0/1,取值为0表示是否会把 、Page 的生命周期函数和 qq 命名空间下的函数调用写入日志,取值为1则不会。默认值是 0

返回值

LogManager

示例代码

  1. const logger = qq.getLogManager({level: 1})
  2. logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
  3. logger.debug({str: 'hello world'}, 'debug log', 100, [1, 2, 3])
  4. logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])

向调试面板中打印日志。console 是一个全局对象,可以直接访问。在QQ客户端中,向 vConsole 中输出日志。

方法

console.debug()

向调试面板中打印 debug 日志

console.log()

向调试面板中打印 log 日志

console.info()

向调试面板中打印 info 日志

console.warn()

向调试面板中打印 warn 日志

console.error()

向调试面板中打印 error 日志

console.group(string label)

在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 console.groupEnd之后分组结束。

console.groupEnd()

结束由 console.group 创建的分组

注意

  • 由于 vConsole 功能有限,以及不同客户端对 console 方法的支持情况有差异,建议开发者在小程序中只使用本文档中提供的方法。

console.debug()

向调试面板中打印 debug 日志

参数

any …args

日志内容,可以有任意多个。

.error

console.error()

向调试面板中打印 error 日志

参数

any …args

.group

console.group(string label)

在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 之后分组结束。

参数

string label

分组标记,可选。

注意

仅在工具中有效,在 vConsole 中为空函数实现。

console.groupEnd()

结束由 console.group 创建的分组

注意

仅在工具中有效,在 vConsole 中为空函数实现。

.info

console.info()

向调试面板中打印 info 日志

参数

any …args

日志内容,可以有任意多个。

.log

console.log()

向调试面板中打印 log 日志

参数

any …args

日志内容,可以有任意多个。

console.warn()

向调试面板中打印 warn 日志

参数

any …args

日志内容,可以有任意多个。

日志管理器实例,可以通过 获取。

方法

LogManager.debug()
LogManager.info()

写 info 日志

LogManager.log()

写 log 日志

LogManager.warn()

写 warn 日志

使用说明

最多保存5M的日志内容,超过5M后,旧的日志内容会被删除。用户可以通过使用 组件的 open-type="feedback" 来上传打印的日志。开发者可以通过小程序管理后台左侧菜单“反馈管理”页面查看。基础库默认会把 AppPage 的生命周期函数和 命名空间下的函数调用写入日志。

.debug

LogManager.debug()

写 debug 日志

参数

Object|Array.<any>|number|string …args

日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb

.info

LogManager.info()

写 info 日志

参数

Object|Array.<any>|number|string …args

日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb

LogManager.log()

写 log 日志

参数

Object|Array.<any>|number|string …args

日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb

.warn

LogManager.warn()

写 warn 日志

参数

Object|Array.<any>|number|string …args

日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb