Debugging and Configuration
Overview
Developers may encounter some errors when integrating the SDK. The SDK will output relevant error logs. Developers can configure the log output path and single log file size as needed.
In addition, the SDK supports calling interfaces to check the current version.
Prerequisites
Before using log-related features, please ensure:
- You have integrated the ZEGO Express SDK into your project and implemented basic real-time audio and video functions. For details, please refer to Quick Start - Integration and Quick Start - Implementation.
- You have created a project in the ZEGOCLOUD Console and obtained a valid AppID and AppSign. For details, please refer to Console - Project Information.
Usage Steps
Set log properties
Before creating the engine, you can set log properties by calling the setLogConfig interface.
The following example shows setting the log storage path to "/data/user/0/package name/files" and the maximum single log file size to 5MB:
// getApplicationSupportDirectory requires using the third-party library path_provider
var filesDir = await getApplicationSupportDirectory();
// Set log storage path
String logPath = filesDir.absolute.path;
// Set maximum single log file size
int logSize = 5242880;
var logConfig = ZegoLogConfig(logPath, logSize);
ZegoExpressEngine.setLogConfig(logConfig);Among them, ZegoLogConfig contains log-related settings (save path and maximum file size), defined as follows:
class ZegoLogConfig {
// Log file save path
String logPath;
// Maximum log file size (Bytes), default is 5MB (5 * 1024 * 1024 Bytes)
int logSize;
ZegoLogConfig(this.logPath, this.logSize);
}Create engine
Define the SDK engine object, call the createEngineWithProfile interface, pass the obtained AppID and AppSign to the parameters "appID" and "appSign", and create the engine singleton object.
// Please obtain through official website registration, format is 123456789L
int appID = appID;
// 64 characters, please obtain through official website registration, format is "0123456789012345678901234567890123456789012345678901234567890123"
String appSign = appSign;
// General scenario access
ZegoScenario scenario = ZegoScenario.GENERAL;
var profile = ZegoEngineProfile(appID, scenario, appSign: appSign);
// Create engine
ZegoExpressEngine.createEngineWithProfile(profile);
// When using Video Call SDK for audio-only scenarios, you can disable the camera, which will not require camera permissions and publish video streams
// ZegoExpressEngine.instance.enableCamera(false);(Optional) Enable debug assistant
It is recommended to call the enableDebugAssistant interface during the development and debugging phase to enable the SDK's debug assistant feature. When subsequently calling other SDK interfaces, it will not only output logs to the console, but also pop up a reminder when interface calls fail, making it convenient for developers to discover problems and fix them in time.
When development is complete and before launching the App, please be sure to disable this feature to avoid UI pop-ups when potential errors occur in the production environment.
ZegoExpressEngine.instance.enableDebugAssistant(true);Get SDK version number
Call the getVersion interface to get the SDK version number. Developers can use the SDK version number information as the Engine version information used by the App, in order to statistics the SDK versions corresponding to each version of the App online.
During SDK operation, when developers find discrepancies with expected situations, they can submit the problem and relevant logs to ZEGOCLOUD Technical Support for localization. ZEGOCLOUD Technical Support may need Engine version information to assist in locating the problem.
ZegoExpressEngine.getVersion();