2016-09-21 16:55:20 -05:00
|
|
|
package com.topjohnwu.magisk.utils;
|
|
|
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
2017-02-07 02:01:32 +08:00
|
|
|
import com.topjohnwu.magisk.MagiskManager;
|
2017-01-25 13:16:50 +08:00
|
|
|
|
2016-09-21 16:55:20 -05:00
|
|
|
public class Logger {
|
|
|
|
|
2016-12-23 23:05:41 +08:00
|
|
|
public static final String TAG = "Magisk";
|
2016-09-21 16:55:20 -05:00
|
|
|
|
2016-12-23 23:05:41 +08:00
|
|
|
public static void debug(String msg) {
|
2017-01-25 16:45:55 +08:00
|
|
|
Log.d(TAG, "DEBUG: " + msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void error(String msg) {
|
2017-04-24 21:52:23 +08:00
|
|
|
Log.e(TAG, "MANAGERERROR: " + msg);
|
2016-12-23 23:05:41 +08:00
|
|
|
}
|
|
|
|
|
2016-09-28 00:33:01 +08:00
|
|
|
public static void dev(String msg, Object... args) {
|
2017-02-07 02:01:32 +08:00
|
|
|
if (MagiskManager.devLogging) {
|
2016-09-21 16:55:20 -05:00
|
|
|
if (args.length == 1 && args[0] instanceof Throwable) {
|
2017-04-24 21:52:23 +08:00
|
|
|
Log.d(TAG, "MANAGER: " + msg, (Throwable) args[0]);
|
2016-09-21 16:55:20 -05:00
|
|
|
} else {
|
2017-04-24 21:52:23 +08:00
|
|
|
Log.d(TAG, "MANAGER: " + String.format(msg, args));
|
2016-09-21 16:55:20 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-09-21 23:36:28 -05:00
|
|
|
|
2016-09-28 00:33:01 +08:00
|
|
|
public static void dev(String msg) {
|
2017-02-07 02:01:32 +08:00
|
|
|
if (MagiskManager.devLogging) {
|
2017-04-24 21:52:23 +08:00
|
|
|
Log.d(TAG, "MANAGER: " + msg);
|
2016-09-28 00:33:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-30 10:41:40 +08:00
|
|
|
public static void shell(boolean root, String msg) {
|
2017-02-07 02:01:32 +08:00
|
|
|
if (MagiskManager.shellLogging) {
|
2017-05-12 03:32:42 +08:00
|
|
|
Log.d(TAG, (root ? "MANAGERSU " : "MANAGERSH ") + msg);
|
2016-09-30 10:41:40 +08:00
|
|
|
}
|
|
|
|
}
|
2016-09-21 16:55:20 -05:00
|
|
|
}
|