From c78896a335da0821acd8c8e3c875ba63893b5e7f Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 4 Jul 2018 18:11:57 +0800 Subject: [PATCH] Get rid of error logs --- .../topjohnwu/magisk/asyncs/UpdateRepos.java | 7 ++----- .../com/topjohnwu/magisk/container/Repo.java | 2 +- .../com/topjohnwu/magisk/utils/Logger.java | 21 ++++++------------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/full/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java b/src/full/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java index 101462e5f..000444df1 100644 --- a/src/full/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java +++ b/src/full/java/com/topjohnwu/magisk/asyncs/UpdateRepos.java @@ -118,11 +118,8 @@ public class UpdateRepos extends ParallelTask { mm.repoDB.addRepo(repo); publishProgress(); } - if (!id.equals(repo.getId())) { - Logger.error("Repo [" + name + "] rid=[" + id + "] id=[" + repo.getId() + "] mismatch"); - } } catch (Repo.IllegalRepoException e) { - Logger.error(e.getMessage()); + Logger.debug(e.getMessage()); mm.repoDB.removeRepo(id); } }); @@ -205,7 +202,7 @@ public class UpdateRepos extends ParallelTask { repo.update(); mm.repoDB.addRepo(repo); } catch (Repo.IllegalRepoException e) { - Logger.error(e.getMessage()); + Logger.debug(e.getMessage()); mm.repoDB.removeRepo(repo); } }); diff --git a/src/full/java/com/topjohnwu/magisk/container/Repo.java b/src/full/java/com/topjohnwu/magisk/container/Repo.java index 41e41fa33..fc99fe790 100644 --- a/src/full/java/com/topjohnwu/magisk/container/Repo.java +++ b/src/full/java/com/topjohnwu/magisk/container/Repo.java @@ -44,7 +44,7 @@ public class Repo extends BaseModule { throw new IllegalRepoException("Repo [" + repoName + "] does not contain versionCode"); } if (getMinMagiskVersion() < Const.MIN_MODULE_VER()) { - Logger.error("Repo [" + repoName + "] is outdated"); + Logger.debug("Repo [" + repoName + "] is outdated"); } } diff --git a/src/full/java/com/topjohnwu/magisk/utils/Logger.java b/src/full/java/com/topjohnwu/magisk/utils/Logger.java index 08d880c11..b3f05c111 100644 --- a/src/full/java/com/topjohnwu/magisk/utils/Logger.java +++ b/src/full/java/com/topjohnwu/magisk/utils/Logger.java @@ -2,18 +2,19 @@ package com.topjohnwu.magisk.utils; import android.util.Log; +import com.topjohnwu.magisk.BuildConfig; + import java.util.Locale; public class Logger { - private static final boolean SHELL_LOGGING = false; - public static void debug(String line) { - Log.d(Const.DEBUG_TAG, "DEBUG: " + line); + if (BuildConfig.DEBUG) + Log.d(Const.DEBUG_TAG, "DEBUG: " + line); } public static void debug(String fmt, Object... args) { - debug(String.format(Locale.US, fmt, args)); + debug(Utils.fmt(fmt, args)); } public static void error(String line) { @@ -21,16 +22,6 @@ public class Logger { } public static void error(String fmt, Object... args) { - error(String.format(Locale.US, fmt, args)); - } - - public static void shell(boolean in, String line) { - if (SHELL_LOGGING) { - Log.d(Const.DEBUG_TAG, (in ? "SHELLIN : " : "SHELLOUT: ") + line); - } - } - - public static void shell(boolean in, String fmt, Object... args) { - shell(in, String.format(Locale.US, fmt, args)); + error(Utils.fmt(fmt, args)); } }