# vConsole
On the real machine, if you want to see theconsoleAPIFor the output log content and additional debugging information, select "Open debugging" in the menu opened by clicking on the button in the upper right corner of the screen.At this point, Weixin Mini Program / MiniGame will exit, and avConsolebutton will appear in the lower right corner after reopening.Click thevConsolebutton to open the log panel.
Weixin Mini Program and MiniGame vConsole display content will have a certain difference, the following figure on the left is a Mini Program vConsole, the right is a small game vConsole

# Instructions for vConsole
Due to the limitations of the implementation mechanism, the developer calls theconsoleAPI to print the log content, which is converted toJSON character string to vConsole, resulting in some restrictions on the content displayed in vConsole]:
- Other than
Number、String、Boolean、nullOther types are treated asObjectto display, print objects and Enumerable properties in the prototype chain. Infinityandnanare displayed asnull.Undefined、ArrayBuffer,FunctionType cannot be displayed- You cannot print an object that has a loop reference
let a = {}
a.b = a
console.log(a) // 2.3.2 以下版本,会打印 `An object width circular reference can't be logged`
In response to the above problems, Weixin Mini Program / MiniGame has done some work with vConsole
- 2.3.2 and above supports printing loop reference objects.Object properties that are referenced by a loop display the reference path,
@representing the object itself.
const circular = { x: {}, c: {} }
circular.x = [{ promise: Promise.resolve() }]
circular.a = circular
circular.c.x0 = circular.x[0]
console.log(circular)
// "{a: '', c: {x0: ''}, x: [{promise: ''}]}"
2.3.1 and above supports the presentation of all types of data.The base library converts the log content once, and the converted content is wrapped in
< >.Examples include:- ``
- ``
- ``
- ``
- ``
- ...
In version 2.2.3 ~ 2.3.0, you can display
ArrayBufferandFunctiontype,undefinedis printed as the character string] 'undefined'
Note: Try to avoid printing log content that is too complex or lengthy in non-debug scenarios (such as elves or material objects in game engines), which may cause additional time consumption. To prevent exceptions from occurring, the log content exceeding a certain length is replaced with "', at which point the developer needs to crop the log contents.