Log posted events.
This commit is contained in:
parent
f673d3a721
commit
5a446c9ab5
3 changed files with 26 additions and 1 deletions
|
@ -40,6 +40,7 @@ public class Config {
|
||||||
public static final boolean logPumpActions = true;
|
public static final boolean logPumpActions = true;
|
||||||
public static final boolean logCongigBuilderActions = true;
|
public static final boolean logCongigBuilderActions = true;
|
||||||
public static final boolean logAutosensData = false;
|
public static final boolean logAutosensData = false;
|
||||||
|
public static final boolean logEvents = true;
|
||||||
|
|
||||||
// DanaR specific
|
// DanaR specific
|
||||||
public static final boolean logDanaBTComm = true;
|
public static final boolean logDanaBTComm = true;
|
||||||
|
|
22
app/src/main/java/info/nightscout/androidaps/LoggingBus.java
Normal file
22
app/src/main/java/info/nightscout/androidaps/LoggingBus.java
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package info.nightscout.androidaps;
|
||||||
|
|
||||||
|
import com.squareup.otto.Bus;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
class LoggingBus extends Bus {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(LoggingBus.class);
|
||||||
|
|
||||||
|
private final Bus delegate;
|
||||||
|
|
||||||
|
public LoggingBus(Bus bus) {
|
||||||
|
delegate = bus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void post(Object event) {
|
||||||
|
log.debug("Event posted: " + event);
|
||||||
|
super.post(event);
|
||||||
|
}
|
||||||
|
}
|
|
@ -104,7 +104,9 @@ public class MainApp extends Application {
|
||||||
log.info("Version: " + BuildConfig.VERSION_NAME);
|
log.info("Version: " + BuildConfig.VERSION_NAME);
|
||||||
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
|
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
|
||||||
|
|
||||||
sBus = new Bus(ThreadEnforcer.ANY);
|
Bus bus = new Bus(ThreadEnforcer.ANY);
|
||||||
|
sBus = Config.logEvents ? new LoggingBus(bus) : bus;
|
||||||
|
|
||||||
sInstance = this;
|
sInstance = this;
|
||||||
sResources = getResources();
|
sResources = getResources();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue