You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
More fixes, more breaks...
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
package com.topjohnwu.magisk.utils;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
|
||||
public class Logger {
|
||||
|
||||
private static final String LOG_TAG = "Magisk";
|
||||
private static final String LOG_TAG = "Magisk: DH";
|
||||
|
||||
public static void dh(String msg, Object... args) {
|
||||
if (PrefHelper.CheckBool("developer_logging")) {
|
||||
Context context = null;
|
||||
try {
|
||||
context = getApplicationUsingReflection();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (PrefHelper.CheckBool("developer_logging", context)) {
|
||||
if (args.length == 1 && args[0] instanceof Throwable) {
|
||||
Log.d(LOG_TAG, msg, (Throwable) args[0]);
|
||||
} else {
|
||||
@@ -17,4 +23,9 @@ public class Logger {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Application getApplicationUsingReflection() throws Exception {
|
||||
return (Application) Class.forName("android.app.AppGlobals")
|
||||
.getMethod("getInitialApplication").invoke(null, (Object[]) null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user