- 1 Integration in Unreal
- 2 Interfaces
Unreal SDK Integration(Linux DS)
This document is to introduce the Linux DS platform Unreal SDK, including the basic integration process, and how to use the interfaces.
1 Integration in Unreal
1.1 Import CrashSight UE Plugin
- CrashSight Linux DS SDK is currently not open for download, please contact "CrashSight Assistant" to get the SDK package.
- Unpack Plugins files under the same directory. Copy the CrashSight directory in the Plugins folder to the Plugins directory under the UE project's root directory (if the folder doesn't exist, create it). Click [file] to refresh [Visual Studio project], then you will see CrashSight plugin code and directory structure in the Visual Studio project, as shown in the image.
- Compile CrashSight plugin source code and project source code together. When done, you can see the CrashSight plugin on the plugin editing page of UE editor, as shown in the image.
1.2 Add CrashSight to the dependencies
Add the following to Build.cs in the main project module:
PrivateDependencyModuleNames.AddRange(new string[] { "CrashSight" });
1.3 Execute Initialization
- About the method: Choose the first scene or the main scene, and call the following code in a script loaded as early as possible to initialize:
#include "CrashSightAgent.h" //Please include this header file
#if DEBUG
CrashSightAgent::ConfigDebugMode (true);
#endif
// Set the target domain name to report to. Please fill in according to project requirements. (required)
CrashSightAgent::ConfigCrashServerUrl("UploadUrl");
// Set the target APP ID, APP KEY and version for reporting and initialize. You can find the APP ID and APP KEY from More->Product Settings->Product Info of the management console.
CrashSightAgent::Init(CrashSightAppId, CrashSightAppKey, AppVersion);
- Domain name for reporting
Domestic public cloud: pc.crashsight.qq.com
Overseas public cloud: pc.crashsight.wetest.net
2 Interfaces
2.1 Initialization
static void InitWithAppId(const char* app_id);
Note: Execute initialization.
Initialize as early as possible to enable crash detection and reporting features.
The appid is CrashSight's unique identifier for the item, and can be viewed in Product Settings -> Product Information.
Parameter | Type | Note |
---|---|---|
app_id | const char* | APP ID of registered projects |
2.2 Reporting errors
static void ReportException(int type, const char* name, const char* reason, const char* stack_trace, const char* extras, bool quit, int dump_native_type = 0);
Note: Proactively report error messages. Can be called manually when an error is caught or needs to be reported, multi-threaded calls are supported. name, reason and stack_trace cannot be null.
Parameter | Type | Note |
---|---|---|
type | int | Exception Type, C#: 4, js: 5, lua: 6 |
name | const char * | Exception Name |
reason | const char * | Exception Info |
stack_trace | const char * | Stack |
extras | const char * | Other Info |
quit | bool | Whether to quit |
dump_native_type | int | Invalid, just fill in 0 |
View page:
extras: Crash Details->Download Attachments->extraMessage.txt
2.3 Setting user ID
static void SetUserId(const char* user_id);
Note: Setting user ID. The user id defaults to unknown.
Parameter | Type | Note |
---|---|---|
user_id | const char * | User ID |
2.4 Adding custom data
static void AddSceneData(const char* key, const char* value);
Note: Set the Key-Value data customized by the user. It will be reported together with exception info when sending the crash. The total length supports up to 128k.
View page: Crash Details->Download Attachments->valueMapOthers.txt
Parameter | Type | Note |
---|---|---|
key | const char * | Key |
value | const char * | Value |
2.5 Setting the application version
static void SetAppVersion(const char* app_version);
Note: Set app version number
Parameter | Type | Note |
---|---|---|
app_version | const char * | Version Number |
2.6 Reporting domain name settings
static void ConfigCrashServerUrl(const char* crash_server_url);
Note: Set domain name for reporting.
Note: Call it before the InitWithAppId interface.
Domain names for reporting are as follow:
Domestic public cloud: pc.crashsight.qq.com
Overseas public cloud: pc.crashsight.wetest.net
A direct CrashSight domain name Integration is different from an indirect one using MSDK. Make sure you follow the above domain name to reconfigure. For other environment domain name, please consult the Integration contact.
Parameter | Type | Note |
---|---|---|
crash_server_url | const char * | Target domain name of reporting |
2.7 Set upload log path
static void SetLogPath(const char* log_path);
Note: Set an upload path for log after a crash. Read permission is required. The attachment is supported up to 8MB.
Parameter | Type | Note |
---|---|---|
log_path | const char * | Log absolute path |
2.8 Enable Debug
static void ConfigDebugMode(bool enable);
Note: Whether to enable debugging mode. Off by default. After enabling, some logs will be printed, but it can help locate issues during tests.
Note: Call it before the InitWithAppId interface.
Parameter | Type | Note |
---|---|---|
enable | bool | Enabling switch for debugging |
2.9 Set device id
static void SetDeviceId(const char* device_id);
Note: Set the device ID, by default uuid is used as the device ID
Note: Call it before the InitWithAppId interface.
Parameter | Type | Note |
---|---|---|
device_id | const char * | Device ID |
2.10 Customize logging
static void PrintLog(LogSeverity level, const char* format, ...);
Note: The custom log shouldn't exceed 30KB.
Parameter | Type | Note |
---|---|---|
level | LogSeverity | Log level |
format | const char * | Log format |
args | params object[] | variable arguments |
Custom log view: issue details -> custom log (from interface)
2.11 Set path to all log files
static void SetRecordFileDir(const char* record_dir);
Note: Set the path to all log files, including SDK logs and dump files, defaults to the directory of the current executable.
Parameter | Type | Note |
---|---|---|
record_dir | const char* | Record file path |