Added debug classes

pull/215/head
M66B 6 months ago
parent 3d367c429f
commit 18c85872f3

@ -100,7 +100,7 @@ internal class RoomTrackingLiveData<T> (
if (isActive) { if (isActive) {
synchronized(lock) { synchronized(lock) {
if (queued.value > 0) { if (queued.value > 0) {
eu.faircode.email.Log.persist(eu.faircode.email.EntityLog.Type.Debug, "$computeFunction queued=" + queued.value) eu.faircode.email.Log.persist(eu.faircode.email.EntityLog.Type.Debug1, "$computeFunction queued=" + queued.value)
} else { } else {
queued.value++ queued.value++
queryExecutor.execute(refreshRunnable) queryExecutor.execute(refreshRunnable)

@ -520,7 +520,7 @@ public class EmailService implements AutoCloseable {
if (auth == AUTH_TYPE_GMAIL || auth == AUTH_TYPE_OAUTH) { if (auth == AUTH_TYPE_GMAIL || auth == AUTH_TYPE_OAUTH) {
try { try {
EntityLog.log(context, EntityLog.Type.Debug, EntityLog.log(context, EntityLog.Type.Debug1,
ex + "\n" + android.util.Log.getStackTraceString(ex)); ex + "\n" + android.util.Log.getStackTraceString(ex));
authenticator.refreshToken(true); authenticator.refreshToken(true);
connect(dnssec, host, port, auth, user, factory); connect(dnssec, host, port, auth, user, factory);

@ -65,7 +65,7 @@ public class EntityLog {
@NonNull @NonNull
public String data; public String data;
public enum Type {General, Statistics, Scheduling, Network, Account, Protocol, Classification, Notification, Rules, Cloud, Debug} public enum Type {General, Statistics, Scheduling, Network, Account, Protocol, Classification, Notification, Rules, Cloud, Debug1, Debug2, Debug3}
public static void log(final Context context, String data) { public static void log(final Context context, String data) {
log(context, Type.General, data); log(context, Type.General, data);
@ -109,7 +109,7 @@ public class EntityLog {
if (context == null) if (context == null)
return; return;
if (type == Type.Debug && if ((type == Type.Debug1 || type == Type.Debug2 || type == Type.Debug3) &&
!(BuildConfig.DEBUG || Log.isTestRelease())) !(BuildConfig.DEBUG || Log.isTestRelease()))
return; return;
@ -233,8 +233,12 @@ public class EntityLog {
return ContextCompat.getColor(context, R.color.solarizedCyan); return ContextCompat.getColor(context, R.color.solarizedCyan);
case Cloud: case Cloud:
return ContextCompat.getColor(context, R.color.solarizedRed); return ContextCompat.getColor(context, R.color.solarizedRed);
case Debug: case Debug1:
return Helper.resolveColor(context, R.attr.colorWarning); return ContextCompat.getColor(context, R.color.solarizedRed);
case Debug2:
return ContextCompat.getColor(context, R.color.solarizedGreen);
case Debug3:
return ContextCompat.getColor(context, R.color.solarizedBlue);
default: default:
return null; return null;
} }

@ -24,7 +24,6 @@ import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
@ -40,6 +39,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.Group; import androidx.constraintlayout.widget.Group;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -203,7 +203,7 @@ public class FragmentLogs extends FragmentBase {
int len = EntityLog.Type.values().length; int len = EntityLog.Type.values().length;
if (!BuildConfig.DEBUG) if (!BuildConfig.DEBUG)
len--; len -= 3;
SpannableStringBuilder[] titles = new SpannableStringBuilder[len]; SpannableStringBuilder[] titles = new SpannableStringBuilder[len];
boolean[] states = new boolean[len]; boolean[] states = new boolean[len];

@ -850,7 +850,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
@OnLifecycleEvent(Lifecycle.Event.ON_ANY) @OnLifecycleEvent(Lifecycle.Event.ON_ANY)
public void onStateChanged() { public void onStateChanged() {
Lifecycle.State state = mowner.getLifecycle().getCurrentState(); Lifecycle.State state = mowner.getLifecycle().getCurrentState();
EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug, "Owner state=" + state); EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug1, "Owner state=" + state);
if (state.equals(Lifecycle.State.DESTROYED)) if (state.equals(Lifecycle.State.DESTROYED))
mowner.getLifecycle().removeObserver(this); mowner.getLifecycle().removeObserver(this);
} }
@ -872,7 +872,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
@Override @Override
public void onChanged(boolean inCall) { public void onChanged(boolean inCall) {
boolean suppress = prefs.getBoolean("notify_suppress_in_call", false); boolean suppress = prefs.getBoolean("notify_suppress_in_call", false);
EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug, EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug1,
"In call=" + inCall + " suppress=" + suppress); "In call=" + inCall + " suppress=" + suppress);
isInCall = (inCall && suppress); isInCall = (inCall && suppress);
boolean fg = Boolean.TRUE.equals(foreground.getValue()); boolean fg = Boolean.TRUE.equals(foreground.getValue());
@ -889,7 +889,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
boolean projection = (connectionState != null && boolean projection = (connectionState != null &&
connectionState == CarConnection.CONNECTION_TYPE_PROJECTION); connectionState == CarConnection.CONNECTION_TYPE_PROJECTION);
boolean suppress = prefs.getBoolean("notify_suppress_in_car", false); boolean suppress = prefs.getBoolean("notify_suppress_in_car", false);
EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug, EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug1,
"Projection=" + projection + " state=" + connectionState + " suppress=" + suppress); "Projection=" + projection + " state=" + connectionState + " suppress=" + suppress);
isInCar = (projection && suppress); isInCar = (projection && suppress);
boolean fg = Boolean.TRUE.equals(foreground.getValue()); boolean fg = Boolean.TRUE.equals(foreground.getValue());

@ -203,7 +203,7 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
LifecycleObserver watcher = new LifecycleObserver() { LifecycleObserver watcher = new LifecycleObserver() {
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
public void onDestroy() { public void onDestroy() {
EntityLog.log(context, EntityLog.Type.Debug, "Owner gone task=" + name); EntityLog.log(context, EntityLog.Type.Debug1, "Owner gone task=" + name);
destroyed = true; destroyed = true;
onDestroyed(args); onDestroyed(args);
owner.getLifecycle().removeObserver(this); owner.getLifecycle().removeObserver(this);

Loading…
Cancel
Save