From 8455c360fce11b9c98d9b452a1ca2e21c496d3ac Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 12 Nov 2022 16:56:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=A5=E5=BF=97=E6=94=B6?= =?UTF-8?q?=E9=9B=86=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/shayu/phonelive/utils/LogUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/shayu/phonelive/utils/LogUtils.java b/app/src/main/java/com/shayu/phonelive/utils/LogUtils.java index 37cbf1015..6aa7404d1 100644 --- a/app/src/main/java/com/shayu/phonelive/utils/LogUtils.java +++ b/app/src/main/java/com/shayu/phonelive/utils/LogUtils.java @@ -42,8 +42,8 @@ public class LogUtils { File dir = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator); if (dir.listFiles() != null) { for (File file : dir.listFiles()) { - if (!file.getName().endsWith(".log") && !"error.log".equals(file.getName())) { - String fileName = file.getName().replace(title, ""); + if (file.getName().endsWith(".log") && !"error.log".equals(file.getName())) { + String fileName = file.getName().replace(title, "").replace(".log", ""); if (isDelLog(fileName)) { file.delete(); } @@ -51,7 +51,7 @@ public class LogUtils { } } File saveFile = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator + today + ".log"); - FileOutputStream os = new FileOutputStream(saveFile,true); + FileOutputStream os = new FileOutputStream(saveFile, true); writer = new PrintWriter(os); while ((line = bufferedReader.readLine()) != null) { writer.append(line).write("\n");