Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions core/src/main/java/org/lsposed/lspd/impl/LSPosedContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,29 @@ public <T, U> U newInstanceSpecial(@NonNull Constructor<T> constructor, @NonNull

@Override
public void log(@NonNull String message) {
Log.i(TAG, mPackageName + ": " + message);
log(Log.INFO, null, message, null);
}

@Override
public void log(@NonNull String message, @NonNull Throwable throwable) {
Log.e(TAG, mPackageName + ": " + message, throwable);
log(Log.ERROR, null, message, throwable);
}

@Override
public void log(int priority, @Nullable String tag, @NonNull String msg, @Nullable Throwable tr) {
String finalTag = (tag != null) ? tag : TAG;

// Format the message with the package name prefix
String prefix = (mPackageName != null) ? mPackageName + ": " : "";
StringBuilder fullMsg = new StringBuilder(prefix).append(msg);

// Handle the Throwable if present
if (tr != null) {
fullMsg.append("\n").append(Log.getStackTraceString(tr));
}

// Use the low-level println to handle dynamic priorities
Log.println(priority, finalTag, fullMsg.toString());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,26 @@

public class Utils {

public static final String LOG_TAG = "LSPosed";
public static final String LOG_TAG = "Vector";
public static final boolean isMIUI = !TextUtils.isEmpty(SystemProperties.get("ro.miui.ui.version.name"));
public static final boolean isLENOVO = !TextUtils.isEmpty(SystemProperties.get("ro.lenovo.region"));

public class Log {
public static final int VERBOSE = android.util.Log.VERBOSE;
public static final int DEBUG = android.util.Log.DEBUG;
public static final int INFO = android.util.Log.INFO;
public static final int WARN = android.util.Log.WARN;
public static final int ERROR = android.util.Log.ERROR;
public static final int ASSERT = android.util.Log.ASSERT;

public static boolean muted = false;

public static void println(int priority, String tag, String msg) {
// Respect the muted flag for everything except ERROR/ASSERT
if (muted && priority < android.util.Log.ERROR) return;
android.util.Log.println(priority, tag, msg);
}

public static String getStackTraceString(Throwable tr) {
return android.util.Log.getStackTraceString(tr);
}
Expand Down
Loading