Log -> AAPSLogger

This commit is contained in:
Milos Kozak 2022-04-23 16:20:50 +02:00
parent cc510da7b1
commit 22d7dda757
6 changed files with 22 additions and 25 deletions

View file

@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.profile.local
import android.os.Bundle import android.os.Bundle
import android.text.Editable import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -38,6 +37,7 @@ import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.ui.TimeListEdit import info.nightscout.androidaps.utils.ui.TimeListEdit
import info.nightscout.shared.SafeParse import info.nightscout.shared.SafeParse
import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign import io.reactivex.rxjava3.kotlin.plusAssign
import java.math.RoundingMode import java.math.RoundingMode
@ -196,7 +196,7 @@ class LocalProfileFragment : DaggerFragment() {
roundUp(Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_MAX_BG[0], GlucoseUnit.MMOL)), roundUp(Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_MAX_BG[0], GlucoseUnit.MMOL)),
roundDown(Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_MAX_BG[1], GlucoseUnit.MMOL)) roundDown(Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_MAX_BG[1], GlucoseUnit.MMOL))
) )
Log.i("TimeListEdit", "build: range1" + range1[0] + " " + range1[1] + " range2" + range2[0] + " " + range2[1]) aapsLogger.info(LTag.CORE, "TimeListEdit", "build: range1" + range1[0] + " " + range1[1] + " range2" + range2[0] + " " + range2[1])
TimeListEdit( TimeListEdit(
context, context,
aapsLogger, aapsLogger,

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.utils.wizard package info.nightscout.androidaps.utils.wizard
import android.util.Log
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
@ -72,7 +71,7 @@ class QuickWizard @Inject constructor(
} }
fun move(from: Int, to: Int) { fun move(from: Int, to: Int) {
Log.i("QuickWizard", "moveItem: $from $to") //Log.i("QuickWizard", "moveItem: $from $to")
val fromEntry = storage[from] as JSONObject val fromEntry = storage[from] as JSONObject
storage.remove(from) storage.remove(from)
addToPos(to, fromEntry, storage) addToPos(to, fromEntry, storage)

View file

@ -1,7 +1,5 @@
package info.nightscout.androidaps.pump.common.utils; package info.nightscout.androidaps.pump.common.utils;
import android.util.Log;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -19,7 +17,7 @@ public class DateTimeUtilUTest {
Assert.assertEquals(65, aTechDateDifferenceAsMinutes); Assert.assertEquals(65, aTechDateDifferenceAsMinutes);
Log.d("DateTimeUtilUTest", "Time difference: " + aTechDateDifferenceAsMinutes); //Log.d("DateTimeUtilUTest", "Time difference: " + aTechDateDifferenceAsMinutes);
} }
} }

View file

@ -6,7 +6,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.wearable.complications.ProviderUpdateRequester; import android.support.wearable.complications.ProviderUpdateRequester;
import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
@ -23,6 +22,8 @@ import info.nightscout.androidaps.interaction.menus.StatusMenuActivity;
import info.nightscout.androidaps.interaction.utils.Constants; import info.nightscout.androidaps.interaction.utils.Constants;
import info.nightscout.androidaps.interaction.utils.DisplayFormat; import info.nightscout.androidaps.interaction.utils.DisplayFormat;
import info.nightscout.androidaps.interaction.utils.WearUtil; import info.nightscout.androidaps.interaction.utils.WearUtil;
import info.nightscout.shared.logging.AAPSLogger;
import info.nightscout.shared.logging.LTag;
import info.nightscout.shared.sharedPreferences.SP; import info.nightscout.shared.sharedPreferences.SP;
/* /*
@ -33,8 +34,7 @@ public class ComplicationTapBroadcastReceiver extends DaggerBroadcastReceiver {
@Inject WearUtil wearUtil; @Inject WearUtil wearUtil;
@Inject DisplayFormat displayFormat; @Inject DisplayFormat displayFormat;
@Inject SP sp; @Inject SP sp;
@Inject AAPSLogger aapsLogger;
private static final String TAG = ComplicationTapBroadcastReceiver.class.getSimpleName();
private static final String EXTRA_PROVIDER_COMPONENT = private static final String EXTRA_PROVIDER_COMPONENT =
"info.nightscout.androidaps.complications.action.PROVIDER_COMPONENT"; "info.nightscout.androidaps.complications.action.PROVIDER_COMPONENT";
@ -58,7 +58,7 @@ public class ComplicationTapBroadcastReceiver extends DaggerBroadcastReceiver {
action = ComplicationAction.valueOf(ComplicationAction.class, complicationAction); action = ComplicationAction.valueOf(ComplicationAction.class, complicationAction);
} catch (IllegalArgumentException | NullPointerException ex) { } catch (IllegalArgumentException | NullPointerException ex) {
// but how? // but how?
Log.e(TAG, "Cannot interpret complication action: " + complicationAction); aapsLogger.error(LTag.WEAR, "Cannot interpret complication action: " + complicationAction);
} }
action = remapActionWithUserPreferences(action); action = remapActionWithUserPreferences(action);

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.interaction.utils; package info.nightscout.androidaps.interaction.utils;
import android.os.PowerManager; import android.os.PowerManager;
import android.util.Log;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -9,6 +8,8 @@ import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.BuildConfig;
import info.nightscout.shared.logging.AAPSLogger;
import info.nightscout.shared.logging.LTag;
/** /**
* Created for xDrip by jamorham on 07/03/2018 * Created for xDrip by jamorham on 07/03/2018
@ -23,10 +24,10 @@ import info.nightscout.androidaps.BuildConfig;
public class Inevitable { public class Inevitable {
@Inject WearUtil wearUtil; @Inject WearUtil wearUtil;
@Inject AAPSLogger aapsLogger;
@Inject Inevitable() {} @Inject Inevitable() {}
private static final String TAG = Inevitable.class.getSimpleName();
private static final int MAX_QUEUE_TIME = (int) Constants.MINUTE_IN_MS * 6; private static final int MAX_QUEUE_TIME = (int) Constants.MINUTE_IN_MS * 6;
private static final boolean debug = BuildConfig.DEBUG; private static final boolean debug = BuildConfig.DEBUG;
@ -42,15 +43,14 @@ public class Inevitable {
task.extendTime(idle_for); task.extendTime(idle_for);
if (debug) if (debug)
Log.d(TAG, "Extending time for: " + id + " to " + wearUtil.dateTimeText(task.when)); aapsLogger.debug(LTag.WEAR, "Extending time for: " + id + " to " + wearUtil.dateTimeText(task.when));
} else { } else {
// otherwise create new task // otherwise create new task
if (runnable == null) return; // extension only if already exists if (runnable == null) return; // extension only if already exists
tasks.put(id, new Task(id, idle_for, runnable)); tasks.put(id, new Task(id, idle_for, runnable));
if (debug) { if (debug) {
Log.d(TAG, aapsLogger.debug(LTag.WEAR, "Creating task: " + id + " due: " + wearUtil.dateTimeText(tasks.get(id).when));
"Creating task: " + id + " due: " + wearUtil.dateTimeText(tasks.get(id).when));
} }
// create a thread to wait and execute in background // create a thread to wait and execute in background
@ -79,7 +79,7 @@ public class Inevitable {
stack++; stack++;
} }
if (stack > 0) { if (stack > 0) {
Log.d(TAG, "Task stacked to: " + id); aapsLogger.debug(LTag.WEAR, "Task stacked to: " + id);
} }
task(id, idle_for, runnable); task(id, idle_for, runnable);
} }
@ -110,12 +110,12 @@ public class Inevitable {
public boolean poll() { public boolean poll() {
final long till = wearUtil.msTill(when); final long till = wearUtil.msTill(when);
if (till < 1) { if (till < 1) {
if (debug) Log.d(TAG, "Executing task! " + this.id); if (debug) aapsLogger.debug(LTag.WEAR, "Executing task! " + this.id);
tasks.remove(this.id); // early remove to allow overlapping scheduling tasks.remove(this.id); // early remove to allow overlapping scheduling
what.run(); what.run();
return true; return true;
} else if (till > MAX_QUEUE_TIME) { } else if (till > MAX_QUEUE_TIME) {
Log.wtf(TAG, "Task: " + this.id + " In queue too long: " + till); aapsLogger.debug(LTag.WEAR, "Task: " + this.id + " In queue too long: " + till);
tasks.remove(this.id); tasks.remove(this.id);
return true; return true;
} }

View file

@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.support.wearable.watchface.WatchFaceStyle; import android.support.wearable.watchface.WatchFaceStyle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -17,6 +16,7 @@ import java.util.Date;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interaction.menus.MainMenuActivity; import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
import info.nightscout.shared.logging.LTag;
public class DigitalStyle extends BaseWatchFace { public class DigitalStyle extends BaseWatchFace {
private static final long TIME_TAP_THRESHOLD = 800; private static final long TIME_TAP_THRESHOLD = 800;
@ -34,7 +34,7 @@ public class DigitalStyle extends BaseWatchFace {
@Override @Override
protected void onTapCommand(int tapType, int x, int y, long eventTime) { protected void onTapCommand(int tapType, int x, int y, long eventTime) {
//tapType = TAP_TYPE_TAP; //tapType = TAP_TYPE_TAP;
Log.d("onTapCommand: DeviceWidth x DeviceHeight /// x , y, TapType >> ", getWidth() + " x " + getHeight() + " /// " + x + " , " + y + " , " + tapType); aapsLogger.debug(LTag.WEAR,"onTapCommand: DeviceWidth x DeviceHeight /// x , y, TapType >> ", getWidth() + " x " + getHeight() + " /// " + x + " , " + y + " , " + tapType);
if (tapType == TAP_TYPE_TAP) { if (tapType == TAP_TYPE_TAP) {
if (eventTime - sgvTapTime < TIME_TAP_THRESHOLD) { if (eventTime - sgvTapTime < TIME_TAP_THRESHOLD) {
@ -111,7 +111,7 @@ public class DigitalStyle extends BaseWatchFace {
try { try {
mShapesElements.setBackground(getResources().getDrawable(getResources().getIdentifier(styleDrawableName, "drawable", getApplicationContext().getPackageName()))); mShapesElements.setBackground(getResources().getDrawable(getResources().getIdentifier(styleDrawableName, "drawable", getApplicationContext().getPackageName())));
} catch (Exception e) { } catch (Exception e) {
Log.e("digitalstyle_frameStyle", "RESOURCE NOT FOUND >> " + styleDrawableName); aapsLogger.error("digitalstyle_frameStyle", "RESOURCE NOT FOUND >> " + styleDrawableName);
} }
// set background-tint-color // set background-tint-color
@ -119,13 +119,13 @@ public class DigitalStyle extends BaseWatchFace {
mShapesElements.setBackgroundTintList(null); mShapesElements.setBackgroundTintList(null);
} else { } else {
String strColorName =(( displayFrameColor.equals("white") || displayFrameColor.equals("black") )?displayFrameColor:displayFrameColor+"_"+displayFrameColorSaturation); String strColorName =(( displayFrameColor.equals("white") || displayFrameColor.equals("black") )?displayFrameColor:displayFrameColor+"_"+displayFrameColorSaturation);
Log.v("digitalstyle_strColorName",strColorName); aapsLogger.debug(LTag.WEAR,"digitalstyle_strColorName",strColorName);
try { try {
ColorStateList colorStateList = ContextCompat.getColorStateList(getApplicationContext(), getResources().getIdentifier(strColorName, "color", getApplicationContext().getPackageName())); ColorStateList colorStateList = ContextCompat.getColorStateList(getApplicationContext(), getResources().getIdentifier(strColorName, "color", getApplicationContext().getPackageName()));
mShapesElements.setBackgroundTintList(colorStateList); mShapesElements.setBackgroundTintList(colorStateList);
} catch (Exception e) { } catch (Exception e) {
mShapesElements.setBackgroundTintList(null); mShapesElements.setBackgroundTintList(null);
Log.e("digitalstyle_colorName", "COLOR NOT FOUND >> " + strColorName); aapsLogger.error("digitalstyle_colorName", "COLOR NOT FOUND >> " + strColorName);
} }
} }
@ -151,7 +151,7 @@ public class DigitalStyle extends BaseWatchFace {
/* display week number */ /* display week number */
Boolean isShowWeekNumber = sp.getBoolean("show_weeknumber", false); Boolean isShowWeekNumber = sp.getBoolean("show_weeknumber", false);
Log.i("---------------------------------","weeknumber refresh "); aapsLogger.info(LTag.WEAR,"---------------------------------","weeknumber refresh ");
TextView mWeekNumber= layoutView.findViewById(R.id.weeknumber); TextView mWeekNumber= layoutView.findViewById(R.id.weeknumber);
if (isShowWeekNumber) { if (isShowWeekNumber) {
mWeekNumber.setVisibility(View.VISIBLE); mWeekNumber.setVisibility(View.VISIBLE);