Crashlytics(Android) clear log before next crash

会有一股神秘感。 提交于 2019-12-12 08:56:23

问题


I have a situation where I want to add some logs to Crashlystic for Android, but not always send it. Then before coming back to the same function I want to clear the log. For this I can't seem to find how to do this. Below is an illustration of the situation:

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"));
    }
}

The problem is that when not clearing the log, the next actual non-fatal crash will have all the logging for all the times it was not intended to be send. I will need just the logs of the last time bar() was called.


回答1:


Mike from Fabric here.

With Crashlytics' logs that functionality isn't an option. You can use [custom keys] (https://docs.fabric.io/android/crashlytics/enhanced-reports.html#custom-keys) and then you can set the value to nil or empty to reset the value.



来源:https://stackoverflow.com/questions/42255778/crashlyticsandroid-clear-log-before-next-crash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!