设置日志级别

通过 Adjust SDK,您可以配置不同日志级别,返回不同数量的信息。可用的日志级别包括:

logLevel描述
AdjustLogLevel.Verbose启用完整日志。
AdjustLogLevel.Debug启用更详细的日志以进行问题调试。
AdjustLogLevel.Info返回信息、警告、错误和断言日志。
AdjustLogLevel.Warn返回警告、错误和断言日志。
AdjustLogLevel.Error只返回错误和断言日志。
AdjustLogLevel.Assert只返回断言日志。
AdjustLogLevel.Suppress禁用所有日志。

您可以在 Adjust prefab 菜单中设置日志级别,或在 config 实例上调用 setLogLevel 方法。

C#
AdjustConfig config = new AdjustConfig("{YourAppToken}", AdjustEnvironment.Sandbox, true);
config.setLogLevel(AdjustLogLevel.Error);
Adjust.start(config);

禁用所有日志

要在手动初始化 SDK 时禁用所有日志输出,请在 config 实例上调用 setLogLevel(AdjustLogLevel.Suppress)。您需要在 AdjustConfig 声明中发送第 3 个参数为 true,以此设置 allowSuppressLogLevel

C#
AdjustConfig adjustConfig = new AdjustConfig("{YourAppToken}", AdjustEnvironment.Sandbox, true);
//...
adjustConfig.setLogLevel(AdjustLogLevel.Suppress);
//...
Adjust.start(adjustConfig);

查看 Windows 已编译日志

如果您的目标对象为 Windows,并希望以 Production​ 模式查看我们库中的编译日志,请在以 Sandbox​ 模式进行测试时,将导出的日志重定向至您的应用。

要记录日志委托,请在 AdjustConfig 示例上调用 setLogDelegate

重要提示:
请务必在初始化 Adjust SDK 之前调用 setLogDelegate 方法。
C#
AdjustConfig adjustConfig = new AdjustConfig("{YourAppToken}", AdjustEnvironment.Sandbox, true);
//...
adjustConfig.setLogDelegate(msg => Debug.Log(msg));
//...
Adjust.start(adjustConfig);