Two more debug classes

master
M66B 3 weeks ago
parent c5b6be9c4b
commit 70cac8ba14

@ -3846,7 +3846,7 @@ class Core {
modified = (force || initialize != 0 || modified = (force || initialize != 0 ||
folder.modseq == null || !folder.modseq.equals(modseq)); folder.modseq == null || !folder.modseq.equals(modseq));
EntityLog.log(context, EntityLog.log(context,
BuildConfig.DEBUG ? EntityLog.Type.Debug3 : EntityLog.Type.General, BuildConfig.DEBUG ? EntityLog.Type.Debug4 : EntityLog.Type.General,
folder.name + " modseq=" + modseq + "/" + folder.modseq + folder.name + " modseq=" + modseq + "/" + folder.modseq +
" force=" + force + " init=" + (initialize != 0) + " modified=" + modified); " force=" + force + " init=" + (initialize != 0) + " modified=" + modified);
} }
@ -4354,7 +4354,7 @@ class Core {
// Update modseq // Update modseq
folder.modseq = modseq; folder.modseq = modseq;
EntityLog.log(context, EntityLog.log(context,
BuildConfig.DEBUG ? EntityLog.Type.Debug3 : EntityLog.Type.General, BuildConfig.DEBUG ? EntityLog.Type.Debug4 : EntityLog.Type.General,
folder.name + " set modseq=" + modseq); folder.name + " set modseq=" + modseq);
db.folder().setFolderModSeq(folder.id, folder.modseq); db.folder().setFolderModSeq(folder.id, folder.modseq);

@ -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, Debug1, Debug2, Debug3} public enum Type {General, Statistics, Scheduling, Network, Account, Protocol, Classification, Notification, Rules, Cloud, Debug1, Debug2, Debug3, Debug4, Debug5}
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.Debug1 || type == Type.Debug2 || type == Type.Debug3) && if ((type == Type.Debug1 || type == Type.Debug2 || type == Type.Debug3 || type == Type.Debug4 || type == Type.Debug5) &&
!(BuildConfig.DEBUG || Log.isTestRelease())) !(BuildConfig.DEBUG || Log.isTestRelease()))
return; return;
@ -239,6 +239,10 @@ public class EntityLog {
return ContextCompat.getColor(context, R.color.solarizedGreen); return ContextCompat.getColor(context, R.color.solarizedGreen);
case Debug3: case Debug3:
return ContextCompat.getColor(context, R.color.solarizedBlue); return ContextCompat.getColor(context, R.color.solarizedBlue);
case Debug4:
return ContextCompat.getColor(context, R.color.solarizedOrange);
case Debug5:
return ContextCompat.getColor(context, R.color.solarizedYellow);
default: default:
return null; return null;
} }

@ -204,7 +204,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 -= 3; len -= 5;
SpannableStringBuilder[] titles = new SpannableStringBuilder[len]; SpannableStringBuilder[] titles = new SpannableStringBuilder[len];
boolean[] states = new boolean[len]; boolean[] states = new boolean[len];

@ -2660,7 +2660,7 @@ public class MessageHelper {
int keylen = modulus.bitLength(); int keylen = modulus.bitLength();
Log.i("DKIM RSA pubkey length=" + keylen); Log.i("DKIM RSA pubkey length=" + keylen);
if (keylen < DKIM_MIN_KEY_LENGTH) { if (keylen < DKIM_MIN_KEY_LENGTH) {
EntityLog.log(context, EntityLog.Type.Debug3, "DKIM RSA pubkey length=" + keylen); EntityLog.log(context, EntityLog.Type.Debug5, "DKIM RSA pubkey length=" + keylen);
throw new IllegalArgumentException("DKIM RSA pubkey length " + keylen + " < " + DKIM_MIN_KEY_LENGTH); throw new IllegalArgumentException("DKIM RSA pubkey length " + keylen + " < " + DKIM_MIN_KEY_LENGTH);
} }
@ -2669,7 +2669,7 @@ public class MessageHelper {
for (int prime = 3; prime <= 65537; prime += 2) for (int prime = 3; prime <= 65537; prime += 2)
if (isPrime(prime) && if (isPrime(prime) &&
modulus.remainder(BigInteger.valueOf(prime)).compareTo(BigInteger.ZERO) == 0) { modulus.remainder(BigInteger.valueOf(prime)).compareTo(BigInteger.ZERO) == 0) {
EntityLog.log(context, EntityLog.Type.Debug3, "DKIM RSA pubkey with small prime=" + prime); EntityLog.log(context, EntityLog.Type.Debug5, "DKIM RSA pubkey with small prime=" + prime);
throw new IllegalArgumentException("DKIM RSA pubkey with small prime=" + prime); throw new IllegalArgumentException("DKIM RSA pubkey with small prime=" + prime);
} }
Log.i("DKIM RSA okay"); Log.i("DKIM RSA okay");

Loading…
Cancel
Save