我正在将Crashlytics sdk 从 Fabric升级到 Firebase for Unity3d 项目,并尝试调整 api 更改以捕获异常。
我需要从下一个参数构造异常实例:
void OnLogMessageReceived(String log, String stackTrace, LogType type)
我现在有
Crashlytics.Log(log);
Crashlytics.Log(stackTrace);
Exception exception = new Exception(type);
Crashlytics.LogException(exception);
是否可以stackTrace
像在 Fabric 中一样发送并使其结构化?
这个包装器运行良好:
class WrappedException : Exception
{
private string oldStackTrace;
public WrappedException(string message, string stackTrace) : base(message)
{
this.oldStackTrace = stackTrace;
}
public override string StackTrace
{
get
{
return this.oldStackTrace;
}
}
}
void OnLogMessageReceived(String log, String stackTrace, LogType type)
{
var exception = new WrappedException(type, stackTrace);
Crashlytics.LogException(exception);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句