This commit is contained in:
Johannes Mockenhaupt 2017-10-21 15:02:53 +02:00
parent 79316bf948
commit 91df07ca8f
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -14,7 +14,7 @@ import info.nightscout.androidaps.events.Event;
/** 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.
* *
* A summary of references between sender and event and event and receiver is printed * A summary of event-receiver calls that occurred so far is logged
* after 10s (after startup) and then again every 60s. * after 10s (after startup) and then again every 60s.
* */ * */
public class LoggingBus extends Bus { public class LoggingBus extends Bus {
@ -57,9 +57,9 @@ public class LoggingBus extends Bus {
log.debug(">>> " + event); log.debug(">>> " + event);
Field methodField = wrapper.getClass().getDeclaredField("method"); Field methodField = wrapper.getClass().getDeclaredField("method");
methodField.setAccessible(true); methodField.setAccessible(true);
Method targcetMethod = (Method) methodField.get(wrapper); Method targetMethod = (Method) methodField.get(wrapper);
String className = targcetMethod.getDeclaringClass().getSimpleName(); String className = targetMethod.getDeclaringClass().getSimpleName();
String methodName = targcetMethod.getName(); String methodName = targetMethod.getName();
String receiverMethod = className + "." + methodName; String receiverMethod = className + "." + methodName;
log.debug(" receiver: " + receiverMethod); log.debug(" receiver: " + receiverMethod);
@ -71,14 +71,14 @@ public class LoggingBus extends Bus {
} }
if (everyMinute < System.currentTimeMillis()) { if (everyMinute < System.currentTimeMillis()) {
log.debug("***************** The story so far ****************"); log.debug("***************** Event -> receiver pairings seen so far ****************");
for (Map.Entry<String, Set<String>> stringSetEntry : event2Receiver.entrySet()) { for (Map.Entry<String, Set<String>> stringSetEntry : event2Receiver.entrySet()) {
log.debug(" " + stringSetEntry.getKey()); log.debug(" " + stringSetEntry.getKey());
for (String s : stringSetEntry.getValue()) { for (String s : stringSetEntry.getValue()) {
log.debug(" -> " + s); log.debug(" -> " + s);
} }
} }
log.debug("***************************************************"); log.debug("*************************************************************************");
everyMinute = System.currentTimeMillis() + 60 * 1000; everyMinute = System.currentTimeMillis() + 60 * 1000;
} }