WeChat mini-games access Fundebug monitoring

I saw Fundebug online mini-game monitoring on SegmentFault. I just started playing WeChat mini-games recently, so I tried to access it.

Access method

When creating a project, select the WeChat mini-game icon in the lower left corner.

clipboard.png

Click Continue to enter the plug-in page.

clipboard.png

The access process of third-party plug-ins in mini games is similar to that of mini programs. You need to download the plug-in code locally and put it in your own project. And you need to configure the receiving domain name of Fundebug to the legitimate domain name of the request.

Wechat can be said to be very strict in terms of supervision/security. You need to be very aware of the network interactions of the plug-ins you use. If there are illegal plug-ins that secretly send data to other places, they will be blocked in WeChat.

Access to jerking games

After creating a WeChat mini-game in the no-AppID mode, you can see the official demo, including the entry files and configuration files: game.js and game.json. game.js introduces and initializes main.js that contains the entire game scene of the plane, the participants (player plane and enemy plane), and the main function of the game logic.

Create a new libsfolder named to store the third-party library files. Right-click the hard disk to open, and then put the fundebug plugin you just downloaded into it.

clipboard.png

Then introduce it in the game.js file, remember to change the copied code releaseto libs.

clipboard.png

error test

According to the documentation of WeChat Mini Games, execute the following commands on the console of WeChat Developer Tools:

fundebug.test("Test""Hello, Fundebug")

clipboard.png

The console of Fundebug can see this error message:

clipboard.png

I think the best thing is that there are still screenshots of the error! That is to say, you can see what the user interface looks like when an error occurs, whether it is a white screen or a chaotic display, etc., all of which can be seen at a glance.

clipboard.png

This function is absolutely necessary to call.

However, I found a problem, that is, the system information and user information are not available when the error occurs. If I really want to contact this user, I don't know who to turn to!
Later, I looked at the documentation. These are not crawled by default and need to be manually configured. For details, please refer to the configuration document:  attribute configuration

clipboard.png

I added some monitoring properties:

clipboard.png

And deliberately changed the code to the wrong (red line position):

clipboard.png

Fundebug will have a small red dot prompt:

clipboard.png

Click to view the error information of the information, including the device information is displayed.

clipboard.png

Moreover, metaData also has the meta information I configured.

clipboard.png

Configure the legitimate domain name of the request

Be sure to configure the request legal domain name . It's easy to forget about this. Because in developer mode, errors can already be reported to Fundebug, so it is easy to forget to configure. I just made this mistake, and I have never received an error!


Original link: https://segmentfault.com/a/1190000014753583

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325633453&siteId=291194637
Recommended