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.