catch bus errors, enable only for dev
This commit is contained in:
parent
105485c9b6
commit
a172458e76
3 changed files with 10 additions and 6 deletions
|
@ -13,11 +13,12 @@ import java.util.Set;
|
|||
import info.nightscout.androidaps.events.Event;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/** Logs events has they're being posted to and dispatched from the event bus.
|
||||
*
|
||||
/**
|
||||
* Logs events has they're being posted to and dispatched from the event bus.
|
||||
* <p>
|
||||
* A summary of event-receiver calls that occurred so far is logged
|
||||
* after 10s (after startup) and then again every 60s.
|
||||
* */
|
||||
*/
|
||||
public class LoggingBus extends Bus {
|
||||
private static Logger log = LoggerFactory.getLogger(L.EVENTS);
|
||||
|
||||
|
@ -49,7 +50,10 @@ public class LoggingBus extends Bus {
|
|||
log.debug(" source: <unknown>");
|
||||
}
|
||||
|
||||
try {
|
||||
super.post(event);
|
||||
} catch (IllegalStateException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -137,7 +137,7 @@ public class MainApp extends Application {
|
|||
engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile();
|
||||
devBranch = BuildConfig.VERSION.contains("dev");
|
||||
|
||||
sBus = L.isEnabled(L.EVENTS) ? new LoggingBus(ThreadEnforcer.ANY) : new Bus(ThreadEnforcer.ANY);
|
||||
sBus = L.isEnabled(L.EVENTS) && devBranch ? new LoggingBus(ThreadEnforcer.ANY) : new Bus(ThreadEnforcer.ANY);
|
||||
|
||||
registerLocalBroadcastReceiver();
|
||||
|
||||
|
|
Loading…
Reference in a new issue