android: guard against potential exceptions when dealing with log handlers

This commit is contained in:
Saúl Ibarra Corretgé 2019-12-17 15:12:50 +01:00 committed by Saúl Ibarra Corretgé
parent e69da98348
commit a79ae9b576
1 changed files with 15 additions and 2 deletions

View File

@ -24,11 +24,24 @@ public class JitsiMeetLogger {
}
public static void addHandler(JitsiMeetBaseLogHandler handler) {
Timber.plant(handler);
if (!Timber.forest().contains(handler)) {
try {
Timber.plant(handler);
} catch (Throwable t) {
Timber.w(t, "Couldn't add log handler");
}
}
}
public static void removeHandler(JitsiMeetBaseLogHandler handler) {
Timber.uproot(handler);
if (Timber.forest().contains(handler)) {
try {
Timber.uproot(handler);
} catch (Throwable t) {
Timber.w(t, "Couldn't remove log handler");
}
}
}
public static void v(String message, Object... args) {