From 8a66b4db2ec66fc0f6c07decdfe8508aaa80dbcb Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 28 Jul 2018 18:07:06 +0200 Subject: [PATCH] OBJECTIVES logging --- .../java/info/nightscout/androidaps/Config.java | 1 + .../info/nightscout/androidaps/Constants.java | 1 + .../ObjectivesFragment.java | 16 ---------------- .../ConstraintsObjectives/ObjectivesPlugin.java | 7 ++++--- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/Config.java b/app/src/main/java/info/nightscout/androidaps/Config.java index 8096ba1486..d419b67411 100644 --- a/app/src/main/java/info/nightscout/androidaps/Config.java +++ b/app/src/main/java/info/nightscout/androidaps/Config.java @@ -44,6 +44,7 @@ public class Config { public static final boolean logDataFood = true; public static final boolean logDataTreatments = true; public static final boolean logNsclient = true; + public static final boolean logObjectives = false; // DanaR specific public static final boolean logDanaBTComm = true; diff --git a/app/src/main/java/info/nightscout/androidaps/Constants.java b/app/src/main/java/info/nightscout/androidaps/Constants.java index df98eef47e..6cb7519ccb 100644 --- a/app/src/main/java/info/nightscout/androidaps/Constants.java +++ b/app/src/main/java/info/nightscout/androidaps/Constants.java @@ -80,4 +80,5 @@ public class Constants { public static final String DATAFOOD = "DATAFOOD"; public static final String DATATREATMENTS = "DATATREATMENTS"; public static final String NSCLIENT = "NSCLIENT"; + public static final String OBJECTIVES = "OBJECTIVES"; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java index 2f896ba91b..3e33b9e926 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java @@ -1,18 +1,15 @@ package info.nightscout.androidaps.plugins.ConstraintsObjectives; -import android.animation.LayoutTransition; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; import android.support.v7.widget.CardView; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearSmoothScroller; import android.support.v7.widget.RecyclerView; import android.text.Html; -import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -21,28 +18,15 @@ import android.widget.CheckBox; import android.widget.LinearLayout; import android.widget.TextView; - -import com.squareup.otto.Subscribe; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Date; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.events.EventConfigBuilderChange; -import info.nightscout.androidaps.events.EventNewBG; -import info.nightscout.androidaps.events.EventProfileSwitchChange; -import info.nightscout.androidaps.events.EventTreatmentChange; import info.nightscout.androidaps.plugins.Common.SubscriberFragment; -import info.nightscout.androidaps.plugins.ConstraintsObjectives.events.EventObjectivesSaved; import info.nightscout.androidaps.plugins.ConstraintsObjectives.objectives.Objective; import info.nightscout.utils.FabricPrivacy; public class ObjectivesFragment extends SubscriberFragment { - private static Logger log = LoggerFactory.getLogger(ObjectivesFragment.class); - RecyclerView recyclerView; CheckBox enableFake; TextView reset; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java index a67f694eb8..10ec7e1fb0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.List; import info.nightscout.androidaps.Config; +import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.interfaces.Constraint; @@ -32,7 +33,7 @@ import info.nightscout.utils.SP; * Created by mike on 05.08.2016. */ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface { - private static Logger log = LoggerFactory.getLogger(ObjectivesPlugin.class); + private static Logger log = LoggerFactory.getLogger(Constants.OBJECTIVES); private static ObjectivesPlugin objectivesPlugin; @@ -94,7 +95,7 @@ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface SP.putBoolean("Objectives" + "bgIsAvailableInNS", bgIsAvailableInNS); SP.putBoolean("Objectives" + "pumpStatusIsAvailableInNS", pumpStatusIsAvailableInNS); SP.putString("Objectives" + "manualEnacts", Integer.toString(manualEnacts)); - if (Config.logPrefsChange) + if (Config.logObjectives) log.debug("Objectives stored"); MainApp.bus().post(new EventObjectivesSaved()); } @@ -107,7 +108,7 @@ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface } catch (Exception e) { log.error("Unhandled exception", e); } - if (Config.logPrefsChange) + if (Config.logObjectives) log.debug("Objectives loaded"); }