Crashlytics(Android)在下一次崩溃之前清除日志

3

我有这样一种情况,我想为Android的Crashlystic添加一些日志,但并不总是发送它。然后在返回到同一函数之前,我想清除日志。对于这一点,我似乎找不到如何做到这一点的方法。以下是该情况的说明:

public foo() {

    bar();
    bar();
    bar();

}

public bar() {
    // Clear log here, but I don't know how
    ...

    // Add new log here.
    Crashlytics.log(1, "TAG", "log information");
    Crashlytics.log(1, "TAG", "log information");
    Crashlytics.log(1, "TAG", "log information");

    if (condition) {
        Crashlytics.logException(new Exception("Throwing the actual non fatal error to log"));
    }
}

问题在于,如果不清除日志,下一次实际的非致命性崩溃将包含所有未打算发送的时间内的所有日志。我只需要最后一次调用 bar() 的日志。
1个回答

1

感谢您的回复。个人而言,我希望能够有这样的功能,但我认为我可以使用自定义键来达到同样的效果。 - Raymond
感谢您的反馈,非常感激! - Mike Bonnell
2
嗨!在Java中,我们可以将String设置为null,但我们不能将int设置为null。那么如何重置intfloatlongdouble为null呢?如何重置这些键? - Bugs Happen

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接