logo
Video Call
On this page

Debugging and Configuration

2023-11-20

Overview

Developers may encounter some errors when integrating the SDK. The SDK outputs relevant error logs. Developers can configure the log output level as needed and set error log pop-ups.

The SDK supports calling interfaces to view the current version.

Example Source Code Download

Please refer to Download Example Source Code to get the source code.

For relevant source code, please view files in the "src/Examples/DebugAndConfig/LogAndVersionAndDebug" directory.

Prerequisites

Before using log-related functions, please ensure:

Usage Steps

Create Engine

Create a ZegoExpressEngine engine instance, pass the applied AppID to the "appID" parameter, and pass the access server address to the "server" parameter.

Note
  • "server" is the access server address. For how to obtain it, please refer to Console - Project Information.
  • For SDK version 3.6.0 and above, server can be changed to an empty string, null, undefined, or any random character, but cannot be left empty.
// Initialize instance
const zg = new ZegoExpressEngine(appID, server);

Set Log Level

Call the setLogConfig interface and use the "logLevel" property in the ZegoLogConfig object to set the log level printed to the local console.

PropertyLog level

logLevel

The following levels increase sequentially from top to bottom. The higher the level, the fewer logs are printed:

  • debug
  • info
  • warn
  • error
  • report
  • disable
const config = {
	logLevel: 'debug',
};
zg.setLogConfig(config);

2.2 If you want to set the log level before initializing the engine, you can set the log level printed to the local console through the "logLevel" property in the object set by the presetLogConfig interface.

ZegoExpressEngine.presetLogConfig({
    logLevel: 'disable'
)

(Optional) Enable Error Message Pop-ups

Call the setDebugVerbose interface after initialization and before logging into the Room to set whether to enable error log message pop-ups, used to prompt errors during development. It is enabled by default in the test environment and disabled by default in the production environment. It is recommended to keep the default configuration.

Note

When the log level is set to "report" and "disable", no pop-up will appear.

// Enable error message pop-ups
zg.setDebugVerbose(false)

View SDK Version Number

Call the getVersion interface to get the SDK version number currently in use.

zg.getVersion()

Previous

Mobile Front and Rear Camera Switching

Next

Usage Restrictions

On this page

Back to top