logging cleanup
This commit is contained in:
parent
6a9bf04a98
commit
35b51af09c
|
@ -23,7 +23,4 @@ public class Config {
|
|||
public static final boolean SMSCOMMUNICATORENABLED = !BuildConfig.NSCLIENTOLNY && !BuildConfig.G5UPLOADER;
|
||||
|
||||
|
||||
public static boolean logConfigBuilder = true;
|
||||
public static boolean logCongigBuilderActions = true;
|
||||
|
||||
}
|
||||
|
|
|
@ -10,11 +10,12 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.Round;
|
||||
|
||||
public class PumpEnactResult {
|
||||
private static Logger log = LoggerFactory.getLogger(PumpEnactResult.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
public boolean success = false; // request was processed successfully (but possible no change was needed)
|
||||
public boolean enacted = false; // request was processed successfully and change has been made
|
||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.Constants;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSgv;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||
|
@ -25,7 +26,7 @@ import info.nightscout.utils.SP;
|
|||
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_BGREADINGS)
|
||||
public class BgReading implements DataPointWithLabelInterface {
|
||||
private static Logger log = LoggerFactory.getLogger(BgReading.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
|
||||
|
||||
@DatabaseField(id = true)
|
||||
public long date;
|
||||
|
|
|
@ -25,6 +25,7 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.interfaces.Interval;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSMbg;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewFragment;
|
||||
|
@ -36,7 +37,7 @@ import info.nightscout.utils.Translator;
|
|||
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_CAREPORTALEVENTS)
|
||||
public class CareportalEvent implements DataPointWithLabelInterface, Interval {
|
||||
private static Logger log = LoggerFactory.getLogger(CareportalEvent.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
|
||||
|
||||
@DatabaseField(id = true)
|
||||
public long date;
|
||||
|
|
|
@ -10,6 +10,8 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 27.02.2016.
|
||||
* <p>
|
||||
|
@ -17,7 +19,7 @@ import org.slf4j.LoggerFactory;
|
|||
*/
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_DBREQUESTS)
|
||||
public class DbRequest {
|
||||
private static Logger log = LoggerFactory.getLogger(DbRequest.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
|
||||
|
||||
@DatabaseField(id = true)
|
||||
public String nsClientID = null;
|
||||
|
|
|
@ -21,6 +21,7 @@ import info.nightscout.androidaps.data.Iob;
|
|||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
||||
import info.nightscout.androidaps.interfaces.Interval;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||
|
@ -36,7 +37,7 @@ import info.nightscout.utils.Round;
|
|||
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_EXTENDEDBOLUSES)
|
||||
public class ExtendedBolus implements Interval, DataPointWithLabelInterface {
|
||||
private static Logger log = LoggerFactory.getLogger(ExtendedBolus.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
|
||||
|
||||
@DatabaseField(id = true)
|
||||
public long date;
|
||||
|
|
|
@ -17,6 +17,7 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.interfaces.Interval;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||
|
@ -27,7 +28,7 @@ import info.nightscout.utils.DecimalFormatter;
|
|||
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_PROFILESWITCHES)
|
||||
public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
||||
private static Logger log = LoggerFactory.getLogger(ProfileSwitch.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
|
||||
|
||||
@DatabaseField(id = true)
|
||||
public long date;
|
||||
|
|
|
@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.09.2017.
|
||||
*/
|
||||
|
@ -15,7 +17,7 @@ import java.util.Objects;
|
|||
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_TDDS)
|
||||
public class TDD {
|
||||
private static Logger log = LoggerFactory.getLogger(TDD.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
|
||||
|
||||
@DatabaseField(id = true)
|
||||
public long date;
|
||||
|
|
|
@ -11,12 +11,13 @@ import java.util.Objects;
|
|||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.interfaces.Interval;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_TEMPTARGETS)
|
||||
public class TempTarget implements Interval {
|
||||
private static Logger log = LoggerFactory.getLogger(TempTarget.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
|
||||
|
||||
@DatabaseField(id = true)
|
||||
public long date;
|
||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.data.IobTotal;
|
|||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
||||
import info.nightscout.androidaps.interfaces.Interval;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
|
||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||
|
@ -28,7 +29,7 @@ import info.nightscout.utils.SP;
|
|||
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_TEMPORARYBASALS)
|
||||
public class TemporaryBasal implements Interval {
|
||||
private static Logger log = LoggerFactory.getLogger(TemporaryBasal.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
|
||||
|
||||
@DatabaseField(id = true)
|
||||
public long date;
|
||||
|
|
|
@ -6,12 +6,14 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 19.03.2018.
|
||||
*/
|
||||
|
||||
public class Constraint<T extends Comparable> {
|
||||
private static Logger log = LoggerFactory.getLogger(Constraint.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
T value;
|
||||
T originalValue;
|
||||
|
@ -57,7 +59,7 @@ public class Constraint<T extends Comparable> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Constraint<T> setIfGreater(T value, String reason, Object from) {
|
||||
public Constraint<T> setIfGreater(T value, String reason, Object from) {
|
||||
if (value.compareTo(this.value) > 0) {
|
||||
this.value = value;
|
||||
mostLimiting.clear();
|
||||
|
@ -74,7 +76,7 @@ public class Constraint<T extends Comparable> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Constraint addMostLimingReason(String reason, Object from) {
|
||||
public Constraint addMostLimingReason(String reason, Object from) {
|
||||
mostLimiting.add(from.getClass().getSimpleName().replace("Plugin", "") + ": " + reason);
|
||||
return this;
|
||||
}
|
||||
|
@ -86,7 +88,8 @@ public class Constraint<T extends Comparable> {
|
|||
if (count++ != 0) sb.append("\n");
|
||||
sb.append(r);
|
||||
}
|
||||
log.debug("Limiting origial value: " + originalValue + " to " + value + ". Reason: " + sb.toString());
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("Limiting origial value: " + originalValue + " to " + value + ". Reason: " + sb.toString());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
@ -110,7 +113,7 @@ public class Constraint<T extends Comparable> {
|
|||
}
|
||||
|
||||
public void copyReasons(Constraint<?> another) {
|
||||
for (String s: another.getReasonList()) {
|
||||
for (String s : another.getReasonList()) {
|
||||
reasons.add(s);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
|
||||
|
@ -14,7 +15,7 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
|||
* Created by mike on 09.06.2016.
|
||||
*/
|
||||
public abstract class PluginBase {
|
||||
private static Logger log = LoggerFactory.getLogger(PluginBase.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||
|
||||
public enum State {
|
||||
NOT_INITIALIZED,
|
||||
|
@ -113,7 +114,8 @@ public abstract class PluginBase {
|
|||
if (state != State.ENABLED) {
|
||||
onStateChange(type, state, State.ENABLED);
|
||||
state = State.ENABLED;
|
||||
log.debug("Starting: " + getName());
|
||||
if (L.isEnabled(L.CORE))
|
||||
log.debug("Starting: " + getName());
|
||||
onStart();
|
||||
}
|
||||
} else { // disabling plugin
|
||||
|
@ -121,7 +123,8 @@ public abstract class PluginBase {
|
|||
onStateChange(type, state, State.ENABLED);
|
||||
state = State.DISABLED;
|
||||
onStop();
|
||||
log.debug("Stopping: " + getName());
|
||||
if (L.isEnabled(L.CORE))
|
||||
log.debug("Stopping: " + getName());
|
||||
}
|
||||
}
|
||||
} else if (type == PluginType.PROFILE) {
|
||||
|
|
|
@ -76,10 +76,12 @@ public class L {
|
|||
public static final String PUMPBTCOMM = "PUMPBTCOMM";
|
||||
public static final String APS = "APS";
|
||||
public static final String PROFILE = "PROFILE";
|
||||
public static final String CONFIGBUILDER = "CONFIGBUILDER";
|
||||
|
||||
private static void initialize() {
|
||||
logElements = new ArrayList<>();
|
||||
logElements.add(new LogElement(CORE, true));
|
||||
logElements.add(new LogElement(CONFIGBUILDER, true));
|
||||
logElements.add(new LogElement(AUTOSENS, false));
|
||||
logElements.add(new LogElement(EVENTS, false, true));
|
||||
logElements.add(new LogElement(BGSOURCE, true));
|
||||
|
|
|
@ -1,35 +1,17 @@
|
|||
package info.nightscout.androidaps.plugins.ConfigBuilder;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.crashlytics.android.answers.CustomEvent;
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.db.CareportalEvent;
|
||||
import info.nightscout.androidaps.db.ProfileSwitch;
|
||||
import info.nightscout.androidaps.db.Source;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.events.EventAppInitialized;
|
||||
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||
import info.nightscout.androidaps.interfaces.BgSourceInterface;
|
||||
import info.nightscout.androidaps.interfaces.Constraint;
|
||||
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
|
@ -38,24 +20,18 @@ import info.nightscout.androidaps.interfaces.ProfileInterface;
|
|||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.interfaces.SensitivityInterface;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Insulin.InsulinOrefRapidActingPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
|
||||
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
||||
import info.nightscout.androidaps.plugins.Sensitivity.SensitivityOref0Plugin;
|
||||
import info.nightscout.androidaps.queue.Callback;
|
||||
import info.nightscout.androidaps.queue.CommandQueue;
|
||||
import info.nightscout.utils.FabricPrivacy;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSUpload;
|
||||
import info.nightscout.utils.SP;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class ConfigBuilderPlugin extends PluginBase {
|
||||
private static Logger log = LoggerFactory.getLogger(ConfigBuilderPlugin.class);
|
||||
private Logger log = LoggerFactory.getLogger(L.CONFIGBUILDER);
|
||||
|
||||
private static ConfigBuilderPlugin configBuilderPlugin;
|
||||
|
||||
|
@ -113,14 +89,15 @@ public class ConfigBuilderPlugin extends PluginBase {
|
|||
|
||||
private void setAlwaysEnabledPluginsEnabled() {
|
||||
for (PluginBase plugin : pluginList) {
|
||||
if (plugin.pluginDescription.alwaysEnabled) plugin.setPluginEnabled(plugin.getType(), true);
|
||||
if (plugin.pluginDescription.alwaysEnabled)
|
||||
plugin.setPluginEnabled(plugin.getType(), true);
|
||||
}
|
||||
storeSettings("setAlwaysEnabledPluginsEnabled");
|
||||
}
|
||||
|
||||
public void storeSettings(String from) {
|
||||
if (pluginList != null) {
|
||||
if (Config.logConfigBuilder)
|
||||
if (L.isEnabled(L.CONFIGBUILDER))
|
||||
log.debug("Storing settings from: " + from);
|
||||
|
||||
for (PluginBase p : pluginList) {
|
||||
|
@ -143,16 +120,18 @@ public class ConfigBuilderPlugin extends PluginBase {
|
|||
private void savePref(PluginBase p, PluginType type, boolean storeVisible) {
|
||||
String settingEnabled = "ConfigBuilder_" + type.name() + "_" + p.getClass().getSimpleName() + "_Enabled";
|
||||
SP.putBoolean(settingEnabled, p.isEnabled(type));
|
||||
log.debug("Storing: " + settingEnabled + ":" + p.isEnabled(type));
|
||||
if (L.isEnabled(L.CONFIGBUILDER))
|
||||
log.debug("Storing: " + settingEnabled + ":" + p.isEnabled(type));
|
||||
if (storeVisible) {
|
||||
String settingVisible = "ConfigBuilder_" + type.name() + "_" + p.getClass().getSimpleName() + "_Visible";
|
||||
SP.putBoolean(settingVisible, p.isFragmentVisible());
|
||||
log.debug("Storing: " + settingVisible + ":" + p.isFragmentVisible());
|
||||
if (L.isEnabled(L.CONFIGBUILDER))
|
||||
log.debug("Storing: " + settingVisible + ":" + p.isFragmentVisible());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSettings() {
|
||||
if (Config.logConfigBuilder)
|
||||
if (L.isEnabled(L.CONFIGBUILDER))
|
||||
log.debug("Loading stored settings");
|
||||
for (PluginBase p : pluginList) {
|
||||
PluginType type = p.getType();
|
||||
|
@ -173,7 +152,8 @@ public class ConfigBuilderPlugin extends PluginBase {
|
|||
else if (p.getType() == type && (p.pluginDescription.enableByDefault || p.pluginDescription.alwaysEnabled)) {
|
||||
p.setPluginEnabled(type, true);
|
||||
}
|
||||
log.debug("Loaded: " + settingEnabled + ":" + p.isEnabled(type));
|
||||
if (L.isEnabled(L.CONFIGBUILDER))
|
||||
log.debug("Loaded: " + settingEnabled + ":" + p.isEnabled(type));
|
||||
if (loadVisible) {
|
||||
String settingVisible = "ConfigBuilder_" + type.name() + "_" + p.getClass().getSimpleName() + "_Visible";
|
||||
if (SP.contains(settingVisible))
|
||||
|
@ -181,7 +161,8 @@ public class ConfigBuilderPlugin extends PluginBase {
|
|||
else if (p.getType() == type && p.pluginDescription.visibleByDefault) {
|
||||
p.setFragmentVisible(type, true);
|
||||
}
|
||||
log.debug("Loaded: " + settingVisible + ":" + p.isFragmentVisible());
|
||||
if (L.isEnabled(L.CONFIGBUILDER))
|
||||
log.debug("Loaded: " + settingVisible + ":" + p.isFragmentVisible());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,10 +170,11 @@ public class ConfigBuilderPlugin extends PluginBase {
|
|||
private void upgradeSettings() {
|
||||
if (!SP.contains("ConfigBuilder_1_NSProfilePlugin_Enabled"))
|
||||
return;
|
||||
if (Config.logConfigBuilder)
|
||||
if (L.isEnabled(L.CONFIGBUILDER))
|
||||
log.debug("Upgrading stored settings");
|
||||
for (PluginBase p : pluginList) {
|
||||
log.debug("Processing " + p.getName());
|
||||
if (L.isEnabled(L.CONFIGBUILDER))
|
||||
log.debug("Processing " + p.getName());
|
||||
for (int type = 1; type < 11; type++) {
|
||||
PluginType newType;
|
||||
switch (type) {
|
||||
|
@ -276,20 +258,21 @@ public class ConfigBuilderPlugin extends PluginBase {
|
|||
}
|
||||
|
||||
void logPluginStatus() {
|
||||
for (PluginBase p : pluginList) {
|
||||
log.debug(p.getName() + ":" +
|
||||
(p.isEnabled(PluginType.GENERAL) ? " GENERAL" : "") +
|
||||
(p.isEnabled(PluginType.TREATMENT) ? " TREATMENT" : "") +
|
||||
(p.isEnabled(PluginType.SENSITIVITY) ? " SENSITIVITY" : "") +
|
||||
(p.isEnabled(PluginType.PROFILE) ? " PROFILE" : "") +
|
||||
(p.isEnabled(PluginType.APS) ? " APS" : "") +
|
||||
(p.isEnabled(PluginType.PUMP) ? " PUMP" : "") +
|
||||
(p.isEnabled(PluginType.CONSTRAINTS) ? " CONSTRAINTS" : "") +
|
||||
(p.isEnabled(PluginType.LOOP) ? " LOOP" : "") +
|
||||
(p.isEnabled(PluginType.BGSOURCE) ? " BGSOURCE" : "") +
|
||||
(p.isEnabled(PluginType.INSULIN) ? " INSULIN" : "")
|
||||
);
|
||||
}
|
||||
if (L.isEnabled(L.CONFIGBUILDER))
|
||||
for (PluginBase p : pluginList) {
|
||||
log.debug(p.getName() + ":" +
|
||||
(p.isEnabled(PluginType.GENERAL) ? " GENERAL" : "") +
|
||||
(p.isEnabled(PluginType.TREATMENT) ? " TREATMENT" : "") +
|
||||
(p.isEnabled(PluginType.SENSITIVITY) ? " SENSITIVITY" : "") +
|
||||
(p.isEnabled(PluginType.PROFILE) ? " PROFILE" : "") +
|
||||
(p.isEnabled(PluginType.APS) ? " APS" : "") +
|
||||
(p.isEnabled(PluginType.PUMP) ? " PUMP" : "") +
|
||||
(p.isEnabled(PluginType.CONSTRAINTS) ? " CONSTRAINTS" : "") +
|
||||
(p.isEnabled(PluginType.LOOP) ? " LOOP" : "") +
|
||||
(p.isEnabled(PluginType.BGSOURCE) ? " BGSOURCE" : "") +
|
||||
(p.isEnabled(PluginType.INSULIN) ? " INSULIN" : "")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void verifySelectionInCategories() {
|
||||
|
@ -386,7 +369,7 @@ public class ConfigBuilderPlugin extends PluginBase {
|
|||
|
||||
private void setFragmentVisiblities(String activePluginName, ArrayList<PluginBase> pluginsInCategory,
|
||||
PluginType pluginType) {
|
||||
if (Config.logConfigBuilder)
|
||||
if (L.isEnabled(L.CONFIGBUILDER))
|
||||
log.debug("Selected interface: " + activePluginName);
|
||||
for (PluginBase p : pluginsInCategory) {
|
||||
if (!p.getName().equals(activePluginName)) {
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainActivity;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
@ -447,7 +446,8 @@ public class LoopPlugin extends PluginBase {
|
|||
request.rate = MainApp.getConstraintChecker().applyBasalConstraints(request.rateConstraint, profile).value();
|
||||
|
||||
if (!pump.isInitialized()) {
|
||||
log.debug("applyAPSRequest: " + MainApp.gs(R.string.pumpNotInitialized));
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applyAPSRequest: " + MainApp.gs(R.string.pumpNotInitialized));
|
||||
if (callback != null) {
|
||||
callback.result(new PumpEnactResult().comment(MainApp.gs(R.string.pumpNotInitialized)).enacted(false).success(false)).run();
|
||||
}
|
||||
|
@ -455,25 +455,26 @@ public class LoopPlugin extends PluginBase {
|
|||
}
|
||||
|
||||
if (pump.isSuspended()) {
|
||||
log.debug("applyAPSRequest: " + MainApp.gs(R.string.pumpsuspended));
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applyAPSRequest: " + MainApp.gs(R.string.pumpsuspended));
|
||||
if (callback != null) {
|
||||
callback.result(new PumpEnactResult().comment(MainApp.gs(R.string.pumpsuspended)).enacted(false).success(false)).run();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.logCongigBuilderActions)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applyAPSRequest: " + request.toString());
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
TemporaryBasal activeTemp = activeTreatments.getTempBasalFromHistory(now);
|
||||
if ((request.rate == 0 && request.duration == 0) || Math.abs(request.rate - pump.getBaseBasalRate()) < pump.getPumpDescription().basalStep) {
|
||||
if (activeTemp != null) {
|
||||
if (Config.logCongigBuilderActions)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applyAPSRequest: cancelTempBasal()");
|
||||
MainApp.getConfigBuilder().getCommandQueue().cancelTempBasal(false, callback);
|
||||
} else {
|
||||
if (Config.logCongigBuilderActions)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applyAPSRequest: Basal set correctly");
|
||||
if (callback != null) {
|
||||
callback.result(new PumpEnactResult().absolute(request.rate).duration(0)
|
||||
|
@ -484,7 +485,7 @@ public class LoopPlugin extends PluginBase {
|
|||
&& activeTemp.getPlannedRemainingMinutes() > 5
|
||||
&& request.duration - activeTemp.getPlannedRemainingMinutes() < 30
|
||||
&& Math.abs(request.rate - activeTemp.tempBasalConvertedToAbsolute(now, profile)) < pump.getPumpDescription().basalStep) {
|
||||
if (Config.logCongigBuilderActions)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applyAPSRequest: Temp basal set correctly");
|
||||
if (callback != null) {
|
||||
callback.result(new PumpEnactResult().absolute(activeTemp.tempBasalConvertedToAbsolute(now, profile))
|
||||
|
@ -492,7 +493,7 @@ public class LoopPlugin extends PluginBase {
|
|||
.comment(MainApp.gs(R.string.let_temp_basal_run))).run();
|
||||
}
|
||||
} else {
|
||||
if (Config.logCongigBuilderActions)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applyAPSRequest: setTempBasalAbsolute()");
|
||||
MainApp.getConfigBuilder().getCommandQueue().tempBasalAbsolute(request.rate, request.duration, false, profile, callback);
|
||||
}
|
||||
|
@ -508,7 +509,8 @@ public class LoopPlugin extends PluginBase {
|
|||
|
||||
long lastBolusTime = activeTreatments.getLastBolusTime();
|
||||
if (lastBolusTime != 0 && lastBolusTime + 3 * 60 * 1000 > System.currentTimeMillis()) {
|
||||
log.debug("SMB requested but still in 3 min interval");
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("SMB requested but still in 3 min interval");
|
||||
if (callback != null) {
|
||||
callback.result(new PumpEnactResult()
|
||||
.comment(MainApp.gs(R.string.smb_frequency_exceeded))
|
||||
|
@ -518,7 +520,8 @@ public class LoopPlugin extends PluginBase {
|
|||
}
|
||||
|
||||
if (!pump.isInitialized()) {
|
||||
log.debug("applySMBRequest: " + MainApp.gs(R.string.pumpNotInitialized));
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applySMBRequest: " + MainApp.gs(R.string.pumpNotInitialized));
|
||||
if (callback != null) {
|
||||
callback.result(new PumpEnactResult().comment(MainApp.gs(R.string.pumpNotInitialized)).enacted(false).success(false)).run();
|
||||
}
|
||||
|
@ -526,14 +529,15 @@ public class LoopPlugin extends PluginBase {
|
|||
}
|
||||
|
||||
if (pump.isSuspended()) {
|
||||
log.debug("applySMBRequest: " + MainApp.gs(R.string.pumpsuspended));
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applySMBRequest: " + MainApp.gs(R.string.pumpsuspended));
|
||||
if (callback != null) {
|
||||
callback.result(new PumpEnactResult().comment(MainApp.gs(R.string.pumpsuspended)).enacted(false).success(false)).run();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.logCongigBuilderActions)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applySMBRequest: " + request.toString());
|
||||
|
||||
// deliver SMB
|
||||
|
@ -544,7 +548,7 @@ public class LoopPlugin extends PluginBase {
|
|||
detailedBolusInfo.isSMB = true;
|
||||
detailedBolusInfo.source = Source.USER;
|
||||
detailedBolusInfo.deliverAt = request.deliverAt;
|
||||
if (Config.logCongigBuilderActions)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("applyAPSRequest: bolus()");
|
||||
MainApp.getConfigBuilder().getCommandQueue().bolus(detailedBolusInfo, callback);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.os.PowerManager;
|
||||
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
|
||||
import info.nightscout.utils.FabricPrivacy;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -16,11 +14,14 @@ import java.util.Date;
|
|||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
|
||||
import info.nightscout.androidaps.queue.commands.Command;
|
||||
import info.nightscout.utils.FabricPrivacy;
|
||||
import info.nightscout.utils.LocalAlertUtils;
|
||||
|
||||
|
||||
|
@ -28,7 +29,7 @@ import info.nightscout.utils.LocalAlertUtils;
|
|||
* Created by mike on 07.07.2016.
|
||||
*/
|
||||
public class KeepAliveReceiver extends BroadcastReceiver {
|
||||
private static Logger log = LoggerFactory.getLogger(KeepAliveReceiver.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||
public static final long STATUS_UPDATE_FREQUENCY = 15 * 60 * 1000L;
|
||||
|
||||
public static void cancelAlarm(Context context) {
|
||||
|
@ -49,7 +50,8 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
checkPump();
|
||||
FabricPrivacy.uploadDailyStats();
|
||||
|
||||
log.debug("KeepAlive received");
|
||||
if (L.isEnabled(L.CORE))
|
||||
log.debug("KeepAlive received");
|
||||
wl.release();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,14 +11,15 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.services.Intents;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSAlarm;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.services.Intents;
|
||||
|
||||
public class NSAlarmReceiver extends BroadcastReceiver {
|
||||
private static Logger log = LoggerFactory.getLogger(NSAlarmReceiver.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
|
|
@ -15,10 +15,11 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.events.EventNetworkChange;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class NetworkChangeReceiver extends BroadcastReceiver {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(NetworkChangeReceiver.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
|
@ -44,17 +45,20 @@ public class NetworkChangeReceiver extends BroadcastReceiver {
|
|||
if (wifiInfo.getSupplicantState() == SupplicantState.COMPLETED) {
|
||||
event.ssid = wifiInfo.getSSID();
|
||||
}
|
||||
log.debug("NETCHANGE: Wifi connected. SSID: " + event.ssid);
|
||||
if (L.isEnabled(L.CORE))
|
||||
log.debug("NETCHANGE: Wifi connected. SSID: " + event.ssid);
|
||||
}
|
||||
}
|
||||
|
||||
if (activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE) {
|
||||
event.mobileConnected = true;
|
||||
event.roaming = activeNetwork.isRoaming();
|
||||
log.debug("NETCHANGE: Mobile connected. Roaming: " + event.roaming);
|
||||
if (L.isEnabled(L.CORE))
|
||||
log.debug("NETCHANGE: Mobile connected. Roaming: " + event.roaming);
|
||||
}
|
||||
} else {
|
||||
log.debug("NETCHANGE: Disconnected.");
|
||||
if (L.isEnabled(L.CORE))
|
||||
log.debug("NETCHANGE: Disconnected.");
|
||||
}
|
||||
|
||||
return event;
|
||||
|
|
|
@ -3,12 +3,10 @@ package info.nightscout.androidaps.tabs;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
@ -17,6 +15,7 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 30.05.2016.
|
||||
|
@ -27,7 +26,7 @@ public class TabPageAdapter extends FragmentPagerAdapter {
|
|||
|
||||
Context context;
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(TabPageAdapter.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||
|
||||
public TabPageAdapter(FragmentManager fm, Context context) {
|
||||
super(fm);
|
||||
|
@ -47,19 +46,19 @@ public class TabPageAdapter extends FragmentPagerAdapter {
|
|||
|
||||
@Override
|
||||
public void finishUpdate(ViewGroup container) {
|
||||
try{
|
||||
try {
|
||||
super.finishUpdate(container);
|
||||
} catch (NullPointerException nullPointerException){
|
||||
} catch (NullPointerException nullPointerException) {
|
||||
System.out.println("Catch the NullPointerException in FragmentStatePagerAdapter.finishUpdate");
|
||||
} catch (IllegalStateException e){
|
||||
log.error(e.getMessage());
|
||||
} catch (IllegalStateException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if(preferences.getBoolean("short_tabtitles", false)){
|
||||
if (preferences.getBoolean("short_tabtitles", false)) {
|
||||
return visibleFragmentList.get(position).getNameShort();
|
||||
}
|
||||
return visibleFragmentList.get(position).getName();
|
||||
|
|
Loading…
Reference in a new issue