mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-01 01:06:11 +00:00
Small improvement
This commit is contained in:
parent
d47e5ec10c
commit
8be1db079e
2 changed files with 8 additions and 4 deletions
|
@ -1502,7 +1502,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
new SimpleTask<Long>() {
|
||||
@Override
|
||||
protected Long onExecute(Context context, Bundle args) throws Throwable {
|
||||
File file = new File(context.getFilesDir(), "crash.log");
|
||||
File file = new File(context.getFilesDir(), Log.CRASH_LOG_NAME);
|
||||
if (file.exists()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try {
|
||||
|
@ -1535,7 +1535,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
ToastEx.makeText(ActivityView.this,
|
||||
Log.formatThrowable(ex, false), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}.execute(this, new Bundle(), "crash:log");
|
||||
}.execute(this, new Bundle(), Log.CRASH_LOG_NAME);
|
||||
}
|
||||
|
||||
private void checkUpdate(boolean always) {
|
||||
|
|
|
@ -195,6 +195,8 @@ import javax.net.ssl.X509TrustManager;
|
|||
public class Log {
|
||||
private static Context ctx;
|
||||
|
||||
static final String CRASH_LOG_NAME = "crash.log";
|
||||
|
||||
private static final long MAX_LOG_SIZE = 8 * 1024 * 1024L;
|
||||
private static final int MAX_CRASH_REPORTS = (BuildConfig.TEST_RELEASE ? 50 : 5);
|
||||
private static final long MIN_FILE_SIZE = 1024 * 1024L;
|
||||
|
@ -1844,12 +1846,14 @@ public class Log {
|
|||
}
|
||||
|
||||
static void writeCrashLog(Context context, Throwable ex) {
|
||||
File file = new File(context.getFilesDir(), "crash.log");
|
||||
File file = new File(context.getFilesDir(), CRASH_LOG_NAME);
|
||||
Log.w("Writing exception to " + file);
|
||||
|
||||
try (FileWriter out = new FileWriter(file, true)) {
|
||||
out.write(BuildConfig.VERSION_NAME + BuildConfig.REVISION + " " + new Date() + "\r\n");
|
||||
out.write(ex + "\r\n" + new ThrowableWrapper(ex).getSafeStackTraceString() + "\r\n");
|
||||
ThrowableWrapper w = new ThrowableWrapper(ex);
|
||||
out.write(w.toSafeString() + "\r\n");
|
||||
out.write(w.getSafeStackTraceString() + "\r\n");
|
||||
} catch (IOException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue