【问题标题】:Crashlytics(Android) clear log before next crashCrashlytics(Android) 在下次崩溃前清除日志
【发布时间】:2017-07-04 11:47:56
【问题描述】:

我有一种情况,我想将一些日志添加到 Crashlystic for Android,但并不总是发送。然后在回到相同的功能之前,我想清除日志。为此,我似乎无法找到如何做到这一点。以下是情况的说明:

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() 的日志。

【问题讨论】:

    标签: android google-fabric crashlytics-android


    【解决方案1】:

    来自 Fabric 的 Mike。

    对于 Crashlytics 的日志,功能不是一个选项。您可以使用 [自定义键] (https://docs.fabric.io/android/crashlytics/enhanced-reports.html#custom-keys),然后可以将值设置为 nil 或为空以重置值。

    【讨论】:

    • 感谢您的回复。我个人希望看到这样的功能,但我认为我可以使用自定义键来管理相同的结果。
    • 感谢您的反馈,非常感谢!
    • 嘿!在 Java 中,我们可以将 String 设置为 null,但我们不能将 int 设置为 null。我们如何将int float long double 重置为空。如何重置这些键?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-26
    相关资源
    最近更新 更多