Crashlytics(Android) clear log before next crash
Asked Answered
G

1

3

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.

Gupta answered 15/2, 2017 at 17:4 Comment(0)
A
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.

Archer answered 17/2, 2017 at 13:41 Comment(3)
Thanks for your reply. Personally I'd like to see a functionality like this, but I think I can manage the same result using custom keys.Gupta
Thanks for the feedback, much appreciated!Archer
Hey! In Java, we can set String to null but we cannot set int to null. How can we reset int float long double to null. How to reset these keys?Catholicize

© 2022 - 2024 — McMap. All rights reserved.