1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-19 05:38:31 +00:00

Enabled tracing when logging is enabled

This commit is contained in:
M66B 2021-12-08 21:49:25 +01:00
parent feb772ccb5
commit 1190111069

View file

@ -109,6 +109,7 @@ public class EmailService implements AutoCloseable {
private String ehlo; private String ehlo;
private boolean log; private boolean log;
private boolean debug; private boolean debug;
private int level;
private Properties properties; private Properties properties;
private Session isession; private Session isession;
private Service iservice; private Service iservice;
@ -180,6 +181,7 @@ public class EmailService implements AutoCloseable {
else if (protocol_since + PROTOCOL_LOG_DURATION < now) else if (protocol_since + PROTOCOL_LOG_DURATION < now)
prefs.edit().putBoolean("protocol", false).apply(); prefs.edit().putBoolean("protocol", false).apply();
this.log = prefs.getBoolean("protocol", false); this.log = prefs.getBoolean("protocol", false);
this.level = prefs.getInt("log_level", Log.getDefaultLogLevel());
this.harden = prefs.getBoolean("ssl_harden", false); this.harden = prefs.getBoolean("ssl_harden", false);
boolean auth_plain = prefs.getBoolean("auth_plain", true); boolean auth_plain = prefs.getBoolean("auth_plain", true);
@ -680,8 +682,10 @@ public class EmailService implements AutoCloseable {
breadcrumbs = new RingBuffer<>(BREADCRUMBS_SIZE); breadcrumbs = new RingBuffer<>(BREADCRUMBS_SIZE);
isession.setDebug(debug || log); boolean trace = (debug || log || level <= android.util.Log.INFO);
if (debug || log)
isession.setDebug(trace);
if (trace)
isession.setDebugOut(new PrintStream(new OutputStream() { isession.setDebugOut(new PrintStream(new OutputStream() {
private ByteArrayOutputStream bos = new ByteArrayOutputStream(); private ByteArrayOutputStream bos = new ByteArrayOutputStream();