Skip to content

Commit

Permalink
opt: log
Browse files Browse the repository at this point in the history
  • Loading branch information
HChenX committed May 6, 2024
1 parent c3cbb6b commit 377ebf7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package com.sevtinge.hyperceiler.ui;

import static com.sevtinge.hyperceiler.utils.log.LogManager.getLogLevel;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
Expand All @@ -28,7 +26,6 @@

import androidx.annotation.Nullable;

import com.sevtinge.hyperceiler.BuildConfig;
import com.sevtinge.hyperceiler.R;
import com.sevtinge.hyperceiler.callback.IResult;
import com.sevtinge.hyperceiler.prefs.PreferenceHeader;
Expand Down Expand Up @@ -63,12 +60,12 @@ public void onCreate(Bundle savedInstanceState) {
}
handler = new Handler(this.getMainLooper());
context = this;
int def = Integer.parseInt(PrefsUtils.mSharedPreferences.getString("prefs_key_log_level", "2"));
int def = Integer.parseInt(PrefsUtils.mSharedPreferences.getString("prefs_key_log_level", "3"));
super.onCreate(savedInstanceState);
new Thread(() -> SearchHelper.getAllMods(MainActivity.this, savedInstanceState != null)).start();
Helpers.checkXposedActivateState(this);
ShellInit.init(this);
PropUtils.setProp("persist.hyperceiler.log.level", ProjectApi.isCanary() ? (def != 3 && def != 4 && def != 0 ? 3 : def) : def);
PropUtils.setProp("persist.hyperceiler.log.level", ProjectApi.isCanary() ? (def != 3 && def != 4 ? 3 : def) : def);
appCrash = CrashData.toPkgList();
handler.postDelayed(() -> {
if (haveCrashReport()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* */
public class AndroidLogUtils {
private static final String Tag = "[HyperCeiler]: ";
private static final int logLevel = PropUtils.getProp("persist.hyperceiler.log.level", 2);
private static final int logLevel = PropUtils.getProp("persist.hyperceiler.log.level", 3);

public static void logI(String tag, String msg) {
if (logLevel < 3) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class LogManager {
public static final int logLevel = getLogLevel();

public static int getLogLevel() {
int level = mPrefsMap.getStringAsInt("log_level", 2);
return BuildConfig.BUILD_TYPE.equals("canary") ? (level != 3 && level != 4 && level != 0 ? 3 : level) : level;
int level = mPrefsMap.getStringAsInt("log_level", 3);
return BuildConfig.BUILD_TYPE.equals("canary") ? (level != 3 && level != 4 ? 3 : level) : level;
}


Expand Down

0 comments on commit 377ebf7

Please sign in to comment.