From 119011106916c7a2a61695fd9e742621811bb958 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 8 Dec 2021 21:49:25 +0100 Subject: [PATCH] Enabled tracing when logging is enabled --- app/src/main/java/eu/faircode/email/EmailService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 3ef341fcd8..84814ab1ac 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -109,6 +109,7 @@ public class EmailService implements AutoCloseable { private String ehlo; private boolean log; private boolean debug; + private int level; private Properties properties; private Session isession; private Service iservice; @@ -180,6 +181,7 @@ public class EmailService implements AutoCloseable { else if (protocol_since + PROTOCOL_LOG_DURATION < now) prefs.edit().putBoolean("protocol", false).apply(); this.log = prefs.getBoolean("protocol", false); + this.level = prefs.getInt("log_level", Log.getDefaultLogLevel()); this.harden = prefs.getBoolean("ssl_harden", false); boolean auth_plain = prefs.getBoolean("auth_plain", true); @@ -680,8 +682,10 @@ public class EmailService implements AutoCloseable { breadcrumbs = new RingBuffer<>(BREADCRUMBS_SIZE); - isession.setDebug(debug || log); - if (debug || log) + boolean trace = (debug || log || level <= android.util.Log.INFO); + + isession.setDebug(trace); + if (trace) isession.setDebugOut(new PrintStream(new OutputStream() { private ByteArrayOutputStream bos = new ByteArrayOutputStream();