This commit is contained in:
Milos Kozak 2018-07-29 00:20:41 +02:00
parent 75bb38ba1f
commit 5ef9bc7948
7 changed files with 39 additions and 43 deletions

View file

@ -23,28 +23,26 @@ public class Config {
public static final boolean SMSCOMMUNICATORENABLED = !BuildConfig.NSCLIENTOLNY && !BuildConfig.G5UPLOADER;
public static final boolean detailedLog = true;
public static final boolean logFunctionCalls = true;
public static final boolean logIncommingData = true;
public static final boolean logAPSResult = true;
public static final boolean logPrefsChange = true;
public static final boolean logConfigBuilder = true;
public static final boolean logNSUpload = true;
public static final boolean logCongigBuilderActions = true;
public static final boolean logAutosensData = false;
public static final boolean logEvents = false;
public static final boolean logQueue = true;
public static final boolean logBgSource = true;
public static final boolean logOverview = true;
public static final boolean logNotification = true;
public static final boolean logAlarm = false;
public static final boolean logDataService = true;
public static final boolean logDataFood = true;
public static final boolean logDataTreatments = true;
public static final boolean logNsclient = true;
public static final boolean logObjectives = false;
public static final boolean logPump = true;
public static boolean logFunctionCalls = true;
public static boolean logAPSResult = true;
public static boolean logPrefsChange = true;
public static boolean logConfigBuilder = true;
public static boolean logCongigBuilderActions = true;
public static boolean logAutosensData = false;
public static boolean logEvents = false;
public static boolean logQueue = true;
public static boolean logBgSource = true;
public static boolean logOverview = true;
public static boolean logNotification = true;
public static boolean logAlarm = false;
public static boolean logDataService = true;
public static boolean logDataFood = true;
public static boolean logDataTreatments = true;
public static boolean logDatabase = true;
public static boolean logNsclient = true;
public static boolean logObjectives = false;
public static boolean logPump = true;
public static boolean logPumpComm = true;
public static final boolean logPumpBtComm = false;
public static boolean logPumpBtComm = false;
}

View file

@ -769,7 +769,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
} else if (list.size() == 1) {
DanaRHistoryRecord record = list.get(0);
if (record._id == null || !record._id.equals(trJson.getString("_id"))) {
if (Config.logIncommingData)
if (Config.logDatabase)
log.debug("Updating _id in DanaR history database: " + trJson.getString("_id"));
record._id = trJson.getString("_id");
getDaoDanaRHistory().update(record);
@ -1320,11 +1320,11 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
if (list.size() == 1) {
CareportalEvent record = list.get(0);
if (Config.logIncommingData)
if (Config.logDatabase)
log.debug("Removing CareportalEvent record from database: " + record.log());
delete(record);
} else {
if (Config.logIncommingData)
if (Config.logDatabase)
log.debug("CareportalEvent not found database: " + _id);
}
} catch (SQLException e) {
@ -1344,12 +1344,12 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
if (list.size() == 0) {
careportalEvent = new CareportalEvent();
careportalEvent.source = Source.NIGHTSCOUT;
if (Config.logIncommingData)
if (Config.logDatabase)
log.debug("Adding CareportalEvent record to database: " + trJson.toString());
// Record does not exists. add
} else if (list.size() == 1) {
careportalEvent = list.get(0);
if (Config.logIncommingData)
if (Config.logDatabase)
log.debug("Updating CareportalEvent record in database: " + trJson.toString());
} else {
log.error("Something went wrong");

View file

@ -25,7 +25,7 @@ public class DbLogger {
if (q.size() < 1) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.nsclientnotinstalled));
log.error("DBADD No receivers");
} else if (Config.logNSUpload) {
} else if (Config.logNsclient) {
if (Config.logNsclient)
log.debug("DBADD dbAdd " + q.size() + " receivers " + data);
}
@ -36,7 +36,7 @@ public class DbLogger {
if (q.size() < 1) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.nsclientnotinstalled));
log.error("DBREMOVE No receivers");
} else if (Config.logNSUpload) {
} else if (Config.logNsclient) {
if (Config.logNsclient)
log.debug("DBREMOVE dbRemove " + q.size() + " receivers " + data);
}

View file

@ -9,7 +9,6 @@ import android.os.HandlerThread;
import android.os.IBinder;
import android.os.PowerManager;
import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
import com.j256.ormlite.dao.CloseableIterator;
@ -23,7 +22,6 @@ import org.slf4j.LoggerFactory;
import java.net.URISyntaxException;
import java.sql.SQLException;
import java.util.Date;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
@ -356,13 +354,12 @@ public class NSClientService extends Service {
log.error("Unhandled exception", e);
return;
}
if (Config.detailedLog)
try {
MainApp.bus().post(new EventNSClientNewLog("ANNOUNCEMENT", JsonHelper.safeGetString(data, "message", "received")));
} catch (Exception e) {
FabricPrivacy.logException(e);
log.error("Unhandled exception", e);
}
try {
MainApp.bus().post(new EventNSClientNewLog("ANNOUNCEMENT", JsonHelper.safeGetString(data, "message", "received")));
} catch (Exception e) {
FabricPrivacy.logException(e);
log.error("Unhandled exception", e);
}
BroadcastAnnouncement.handleAnnouncement(data, getApplicationContext());
if (Config.logNsclient)
log.debug(data.toString());

View file

@ -77,7 +77,7 @@ public class NSProfilePlugin extends PluginBase implements ProfileInterface {
MainApp.bus().post(new EventProfileStoreChanged());
MainApp.bus().post(new EventNSProfileUpdateGUI());
}
if (Config.logIncommingData)
if (Config.logNsclient)
log.debug("Received profileStore: " + activeProfile + " " + profile);
} catch (JSONException e) {
log.error("Unhandled exception", e);

View file

@ -7,15 +7,16 @@ import android.support.v4.content.WakefulBroadcastReceiver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.services.DataService;
import info.nightscout.androidaps.Config;
public class DataReceiver extends WakefulBroadcastReceiver {
private static Logger log = LoggerFactory.getLogger(DataReceiver.class);
private static Logger log = LoggerFactory.getLogger(Constants.DATASERVICE);
@Override
public void onReceive(Context context, Intent intent) {
if (Config.logFunctionCalls)
if (Config.logDataService)
log.debug("onReceive " + intent);
startWakefulService(context, new Intent(context, DataService.class)
.setAction(intent.getAction())

View file

@ -124,7 +124,7 @@ public class DataService extends IntentService {
private void handleNewDataFromNSClient(Intent intent) {
Bundle bundles = intent.getExtras();
if (bundles == null) return;
if (Config.logIncommingData)
if (Config.logDataService)
log.debug("Got intent: " + intent.getAction());
@ -254,7 +254,7 @@ public class DataService extends IntentService {
NSMbg nsMbg = new NSMbg(mbgJson);
CareportalEvent careportalEvent = new CareportalEvent(nsMbg);
MainApp.getDbHelper().createOrUpdate(careportalEvent);
if (Config.logIncommingData)
if (Config.logDataService)
log.debug("Adding/Updating new MBG: " + careportalEvent.log());
}