2016-09-21 16:55:20 -05:00
|
|
|
package com.topjohnwu.magisk.utils;
|
|
|
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
2017-01-25 13:16:50 +08:00
|
|
|
import com.topjohnwu.magisk.Global;
|
|
|
|
|
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) {
|
|
|
|
Log.e(TAG, "ERROR: " + 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-01-25 13:16:50 +08:00
|
|
|
if (Global.Configs.devLogging) {
|
2016-09-21 16:55:20 -05:00
|
|
|
if (args.length == 1 && args[0] instanceof Throwable) {
|
2017-01-25 16:45:55 +08:00
|
|
|
Log.d(TAG, "DEV: " + msg, (Throwable) args[0]);
|
2016-09-21 16:55:20 -05:00
|
|
|
} else {
|
2017-01-25 16:45:55 +08:00
|
|
|
Log.d(TAG, "DEV: " + 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-01-25 13:16:50 +08:00
|
|
|
if (Global.Configs.devLogging) {
|
2017-01-25 16:45:55 +08:00
|
|
|
Log.d(TAG, "DEBUG: " + 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-01-25 13:16:50 +08:00
|
|
|
if (Global.Configs.shellLogging) {
|
2016-09-30 10:41:40 +08:00
|
|
|
Log.d(root ? "SU" : "SH", msg);
|
|
|
|
}
|
|
|
|
}
|
2016-09-21 16:55:20 -05:00
|
|
|
}
|