Outline
MSDK integrates Bugly's data reporting function. When the client crashes, it can upload the client information to the server for the developer to view. It can help developers find the online fatal bugs of their apps.
The following picture shows that after the online app crashes, the developer can view the client information through the Bugly platform (Note: Bugly does not report screenshots when an app crashes):
1) Report the stack information of the crashed process, as shown in the following figures: "Malfunctioned thread", "All threads", "System log".
2) Report the basic information of the current mobile phone: device name(vendor, model), system version, disk's available ratio, SD card's available ratio, memory's available ratio and so on.
3) Report the user's openid, as shown in the following picture "User name".
4)User-defined reporting information, as shown in the following figure "More information".
You can define the string reported when the app crashes, as shown below
You can upload a small number of user-defined logs about app crash to the Bulgy platform and view it in Extra Data -> User-defined Log
Access Guide
1 Preconditions
1) You have completed initialization according to the initialization module's description initialization
2) Configure App restoration symbol table
Please go to the Bulgy platform to set the restoration symbol table at:http://bugly.qq.com/.Refer to symbol table configuration in the Official Website of bugly to complete the configuration.
2 Refer to demos
For callback setting, please refer to OnCrashExtMessageNotify method shown in MSDKDemo/MyObserver.mm file.
For interface call, please refer to the location where various methods call WGBuglyLog, as shown in MSDKDemo/LoginSucceedVC.mm file.
3 View the reported data
Please use the collaborator's account to login the website bugly.qq.com and select the app you want to view, as shown in the figure below, and then view the data reported by bugly. If you do not know the collaborator account, please contact"Flying Eagle Assistant"or"Link to MSDK".
Callback of reporting the addition of extra logs
1)Function description
When the program crashes, the callback OnCrashExtMessageNotify will notify the game. At this time, the game may add some extra user-defined data, which will be reported to Bugly platform together with the crash log. This can help better locate the cause of the crash. The reported data can be found at "User-defined log"->"Extra data" in Bugly platform.
2)Interface declaration
std::string OnCrashExtMessageNotify();
3)Parameter description
None
4)Return value
Return value type | Description | |
---|---|---|
string | report the user-defined string when crash occurs |
5)Demo code
std::string MyObserver::OnCrashExtMessageNotify()
{
return "dsafdasfsafdasdfasdf";
}
6)Special description
In native reporting, there is no redundant time for execution of this callback in case of too fast crash, and this callback may expire. If the more effective data reporting method is required, call Bugly user-defined log reporting interface WGBuglyLog.
7)Term interpretation
None
report Lua/C#/JS script error
1)Function description
When the Lua/C#/JS script of the game is exceptional, the exception messages can be reported to bugly.Report script exception messages to bugly, perform "error analysis" on bugly -> view the reported information under tab "Lua script error /C# script error/JS script error"
2)Interface declaration
void WGReportException(eExceptionType exception_type,
unsigned char *exception_name,
unsigned char *exception_msg,
unsigned char *exception_stack,
std::vector<KVPair> &ext_info)
3)Parameter description
name | type | description |
---|---|---|
exception_type | eExceptionType enumeration type型 | exception type |
exception_name | unsigned char * | exception name |
exception_msg | unsigned char * | exception messages |
exception_stack | unsigned char * | exception stack |
ext_info | vector |
event content, a Dictionary in form of key-value; the maximum length of the key is 64. The maximum length of the value is 1024. The maximum number of keys is 50. For the naming rules of the key, "B1" and "B2" are recommended so as to reduce traffic consumption |
4)Return value and callback description
None
5)Demo code
std::vector<KVPair>extInfo;
KVPair item;
item.key="extInfo_Body";
item.value=std::string("wegame_extInfo_body");
eveList.push_back(item);
WGPlatform::GetInstance()->WGReportException((eExceptionType) exceptionType,
"MSDK_excetipon_name",
"MSDK_exception_msg",
"MSDK_exception_stack_test",
extInfo);
6)Special description
None
7)Term interpretation
None
Bugly user-defined log reporting
1)Function description
In some native crash scenes, OnCrashExtMessageNotify, an event callback function registered to Bugly, may fail to be executed. In this case, you are advised to make use of the user-defined log interface. Such an interface may record and cache the log demanded by the game during the game running process, and it can report exceptions when exceptions occur (the reporting log is up to 30K).
On the bugly webpage, check the custom log reported in "Error Analysis" -> “Custom Error”.
2)Interface declaration
void WGBuglyLog (eBuglyLogLevel level, unsigned char* log);
3)Parameter description
Parameter name | Parameter type | Description |
---|---|---|
level | enum | For details, seeeBuglyLogLevelsection in the struct description |
log | unsigned char* | Content to be uploaded (printed) |
4)Return value and callback description
None
5)Demo code
WGPlatform::GetInstance()->WGBuglyLog(eBuglyLogLevel_I, (unsigned char*)"login qq, flag:0");
6)Special description
None
7)Term interpretation
None
Close Bugly reporting dynamically
1 General description
Close Bugly reporting dynamically. When this interface is called, crash reporting will be closed but other Bugly functions will not be affected; crashes triggered by the restart of the app will be reported normally.
2 Interface call
1) Function description
In some scenarios, apps do not need to report a crash, such as: some apps do not want to report to Bugly crashes triggered during the killing of processes; at this time, they can call this interface to close crash reporting, but other Bugly functions will not be affected; crashes triggered by the restart of the apps will be reported normally.
2) Interface declaration
void WGCloseCrashReport();
3) Parameter description
None
4) Demo code
WGPlatform::GetInstance()->WGCloseCrashReport();
6) Special instructions
After this interface is called to close crash reporting, other Bugly functions will not be affected; crashes triggered by the restart of the app will be reported normally.
7) Term explanation
None