mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 17:27:45 +00:00
11a2ed0743
Exception logging tends to be race-y, so now we block and wait for all logs to be written before continuing with the crash.
22 lines
646 B
Java
22 lines
646 B
Java
package org.thoughtcrime.securesms.logging;
|
|
|
|
import android.support.annotation.NonNull;
|
|
|
|
public class UncaughtExceptionLogger implements Thread.UncaughtExceptionHandler {
|
|
|
|
private static final String TAG = UncaughtExceptionLogger.class.getSimpleName();
|
|
|
|
private final Thread.UncaughtExceptionHandler originalHandler;
|
|
|
|
public UncaughtExceptionLogger(@NonNull Thread.UncaughtExceptionHandler originalHandler) {
|
|
this.originalHandler = originalHandler;
|
|
}
|
|
|
|
@Override
|
|
public void uncaughtException(Thread t, Throwable e) {
|
|
Log.e(TAG, "", e);
|
|
Log.blockUntilAllWritesFinished();
|
|
originalHandler.uncaughtException(t, e);
|
|
}
|
|
}
|