mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-23 06:31:17 +00:00
Log simplification
This commit is contained in:
parent
d9e89067b5
commit
6b4e92fe8d
4 changed files with 11 additions and 14 deletions
|
@ -313,7 +313,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
private boolean language_detection;
|
||||
private List<String> languages;
|
||||
private static boolean debug;
|
||||
private int level;
|
||||
private boolean canDarken;
|
||||
private boolean fake_dark;
|
||||
private boolean show_recent;
|
||||
|
@ -1550,7 +1549,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
tvError.setVisibility(View.VISIBLE);
|
||||
ibError.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (BuildConfig.DEBUG && level <= android.util.Log.INFO)
|
||||
if (BuildConfig.DEBUG && Log.isDebugLogLevel())
|
||||
error = message.thread;
|
||||
tvError.setText(error);
|
||||
tvError.setVisibility(error == null ? View.GONE : View.VISIBLE);
|
||||
|
@ -7375,7 +7374,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
languages = null;
|
||||
|
||||
debug = prefs.getBoolean("debug", false);
|
||||
level = prefs.getInt("log_level", Log.getDefaultLogLevel());
|
||||
|
||||
this.canDarken = WebViewEx.isFeatureSupported(context, WebViewFeature.ALGORITHMIC_DARKENING);
|
||||
this.fake_dark = prefs.getBoolean("fake_dark", false);
|
||||
|
|
|
@ -110,7 +110,6 @@ 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;
|
||||
|
@ -189,7 +188,6 @@ 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.ssl_harden = prefs.getBoolean("ssl_harden", false);
|
||||
this.ssl_harden_strict = prefs.getBoolean("ssl_harden_strict", false);
|
||||
this.cert_strict = prefs.getBoolean("cert_strict", !BuildConfig.PLAY_STORE_RELEASE);
|
||||
|
@ -725,7 +723,7 @@ public class EmailService implements AutoCloseable {
|
|||
|
||||
breadcrumbs = new RingBuffer<>(BREADCRUMBS_SIZE);
|
||||
|
||||
boolean trace = (debug || log || level <= android.util.Log.INFO);
|
||||
boolean trace = (debug || log || Log.isDebugLogLevel());
|
||||
|
||||
isession.setDebug(trace);
|
||||
if (trace)
|
||||
|
|
|
@ -2177,7 +2177,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
swMainLogMem.setChecked(prefs.getBoolean("main_log_memory", false));
|
||||
swMainLogMem.setEnabled(swMainLog.isChecked());
|
||||
swProtocol.setChecked(prefs.getBoolean("protocol", false));
|
||||
swLogInfo.setChecked(prefs.getInt("log_level", Log.getDefaultLogLevel()) <= android.util.Log.INFO);
|
||||
swLogInfo.setChecked(Log.isDebugLogLevel());
|
||||
swDebug.setChecked(prefs.getBoolean("debug", false));
|
||||
swCanary.setChecked(prefs.getBoolean("leak_canary", false));
|
||||
swTest1.setChecked(prefs.getBoolean("test1", false));
|
||||
|
|
|
@ -214,13 +214,15 @@ public class Log {
|
|||
boolean debug = prefs.getBoolean("debug", false);
|
||||
if (debug)
|
||||
level = android.util.Log.DEBUG;
|
||||
else
|
||||
level = prefs.getInt("log_level", getDefaultLogLevel());
|
||||
else {
|
||||
int def = (BuildConfig.DEBUG ? android.util.Log.INFO : android.util.Log.WARN);
|
||||
level = prefs.getInt("log_level", def);
|
||||
}
|
||||
android.util.Log.d(TAG, "Log level=" + level);
|
||||
}
|
||||
|
||||
public static int getDefaultLogLevel() {
|
||||
return (BuildConfig.DEBUG ? android.util.Log.INFO : android.util.Log.WARN);
|
||||
public static boolean isDebugLogLevel() {
|
||||
return (level <= android.util.Log.INFO);
|
||||
}
|
||||
|
||||
public static int d(String msg) {
|
||||
|
@ -1924,7 +1926,6 @@ public class Log {
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean main_log = prefs.getBoolean("main_log", true);
|
||||
boolean protocol = prefs.getBoolean("protocol", false);
|
||||
int level = prefs.getInt("log_level", Log.getDefaultLogLevel());
|
||||
long last_cleanup = prefs.getLong("last_cleanup", 0);
|
||||
|
||||
PackageManager pm = context.getPackageManager();
|
||||
|
@ -1979,8 +1980,8 @@ public class Log {
|
|||
sb.append(String.format("SoC: %s/%s\r\n", Build.SOC_MANUFACTURER, Build.SOC_MODEL));
|
||||
sb.append(String.format("OS version: %s\r\n", osVersion));
|
||||
sb.append(String.format("uid: %d\r\n", android.os.Process.myUid()));
|
||||
sb.append(String.format("Log main: %b protocol: %b level: %d=%b\r\n",
|
||||
main_log, protocol, level, level <= android.util.Log.INFO));
|
||||
sb.append(String.format("Log main: %b protocol: %b debug: %b build: %b\r\n",
|
||||
main_log, protocol, Log.isDebugLogLevel(), BuildConfig.DEBUG));
|
||||
sb.append("\r\n");
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
|
|
Loading…
Reference in a new issue