Write crash info in Markdown

This commit is contained in:
ByteHamster 2020-04-08 20:57:23 +02:00
parent 12781c9101
commit 7d8d53d218
1 changed files with 11 additions and 9 deletions

View File

@ -35,12 +35,14 @@ public class CrashReportWriter implements Thread.UncaughtExceptionHandler {
PrintWriter out = null; PrintWriter out = null;
try { try {
out = new PrintWriter(new FileWriter(path)); out = new PrintWriter(new FileWriter(path));
out.println("[ Crash info ]"); out.println("## Crash info");
out.println("Time: " + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", Locale.getDefault()).format(new Date())); out.println("Time: " + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", Locale.getDefault()).format(new Date()));
out.println("AntennaPod version: " + BuildConfig.VERSION_NAME); out.println("AntennaPod version: " + BuildConfig.VERSION_NAME);
out.println(); out.println();
out.println("[ StackTrace ]"); out.println("## StackTrace");
out.println("```");
ex.printStackTrace(out); ex.printStackTrace(out);
out.println("```");
} catch (IOException e) { } catch (IOException e) {
Log.e(TAG, Log.getStackTraceString(e)); Log.e(TAG, Log.getStackTraceString(e));
} finally { } finally {
@ -50,12 +52,12 @@ public class CrashReportWriter implements Thread.UncaughtExceptionHandler {
} }
public static String getSystemInfo() { public static String getSystemInfo() {
return "[ Environment ]" + return "## Environment"
"\nAndroid version: " + Build.VERSION.RELEASE + + "\nAndroid version: " + Build.VERSION.RELEASE
"\nOS version: " + System.getProperty("os.version") + + "\nOS version: " + System.getProperty("os.version")
"\nAntennaPod version: " + BuildConfig.VERSION_NAME + + "\nAntennaPod version: " + BuildConfig.VERSION_NAME
"\nModel: " + Build.MODEL + + "\nModel: " + Build.MODEL
"\nDevice: " + Build.DEVICE + + "\nDevice: " + Build.DEVICE
"\nProduct: " + Build.PRODUCT; + "\nProduct: " + Build.PRODUCT;
} }
} }