跳到主要内容

实时调试

最近更新 2026/10/02
注意

SDK Debug 模式仅供接入调试时使用,严禁应用在生产环境。

开启日志打印​

TDLog::enable = true;

使用 TDDebugConsumer​

在SDK接入过程中,您可以通过使用AE的Debug功能,进行实时调试。使用Debug功能需要如下两步操作:

  1. 使用TDDebugConsumer

以下使用TDDebugConsumer的示例代码:

string deviceId = "123456789";
TDDebugConsumer debugConsumer("appId", "serverUrl", "", deviceId);
TDAnalytics te(debugConsumer);

TDPropertiesNode event_properties;
event_properties.SetString("name", "value");
// track事件
te.track("accountId", "distinctId", "eventName", event_properties);
  1. AE后台添加Debug设备

为了避免 Debug 模式在生产环境上线,规定只有指定的设备才能开启 Debug 模式。只有在客户端开启了 Debug 模式,并且设备 ID 在 AE 后台「数据 → 埋点管理 → Debug 模式」页面中添加了的设备才能开启 Debug 模式。添加方法:在该页面点击右上角「接入设备」,在「选择设备」抽屉里点击「添加设备」,填入设备 ID。

Debug 模式可能会影响数据采集质量和 App 的稳定性,只用于集成阶段数据验证,不要在线上环境使用。

这篇文档对你有帮助吗?