调整日志格式

This commit is contained in:
zlzw 2023-02-27 16:33:40 +08:00
parent e7c97f2b55
commit 94f8ee7f3b
2 changed files with 3 additions and 2 deletions

View File

@ -122,11 +122,11 @@ public class AppContext extends CommonAppContext {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
//注册全局异常捕获
if (!isMainProcess()) { if (!isMainProcess()) {
return; return;
} }
CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis()); CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis());
//注册全局异常捕获
registerError(); registerError();
registerFirebaseCrash(); registerFirebaseCrash();
LogUtils.start(this); LogUtils.start(this);

View File

@ -31,7 +31,7 @@ public class LogUtils {
String[] exec = new String[]{"logcat", "-c"}; String[] exec = new String[]{"logcat", "-c"};
Runtime.getRuntime().exec(exec).waitFor(); Runtime.getRuntime().exec(exec).waitFor();
exec = new String[]{"logcat", "-v", "UTC", "-D"}; exec = new String[]{"logcat", "-v", "color", "UTC-8"};
Process process = Runtime.getRuntime().exec(exec); Process process = Runtime.getRuntime().exec(exec);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream())); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
@ -55,6 +55,7 @@ public class LogUtils {
writer = new PrintWriter(os); writer = new PrintWriter(os);
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
writer.append(line).write("\n"); writer.append(line).write("\n");
writer.flush();
} }
writer.flush(); writer.flush();
writer.close(); writer.close();