调整日志格式

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
public void onCreate() {
super.onCreate();
//注册全局异常捕获
if (!isMainProcess()) {
return;
}
CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis());
//注册全局异常捕获
registerError();
registerFirebaseCrash();
LogUtils.start(this);

View File

@ -31,7 +31,7 @@ public class LogUtils {
String[] exec = new String[]{"logcat", "-c"};
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);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
@ -55,6 +55,7 @@ public class LogUtils {
writer = new PrintWriter(os);
while ((line = bufferedReader.readLine()) != null) {
writer.append(line).write("\n");
writer.flush();
}
writer.flush();
writer.close();