33 lines
759 B
Java
Raw Normal View History

2016-09-21 16:55:20 -05:00
package com.topjohnwu.magisk.utils;
import android.util.Log;
public class Logger {
public static final String LOG_TAG = "Magisk: DEV";
2016-09-21 16:55:20 -05:00
2016-09-30 11:35:46 +08:00
public static boolean logShell, devLog;
2016-09-30 10:41:40 +08:00
2016-09-28 00:33:01 +08:00
public static void dev(String msg, Object... args) {
2016-09-30 11:35:46 +08:00
if (devLog) {
2016-09-21 16:55:20 -05:00
if (args.length == 1 && args[0] instanceof Throwable) {
Log.d(LOG_TAG, msg, (Throwable) args[0]);
} else {
Log.d(LOG_TAG, String.format(msg, args));
}
}
}
2016-09-21 23:36:28 -05:00
2016-09-28 00:33:01 +08:00
public static void dev(String msg) {
2016-09-30 11:35:46 +08:00
if (devLog) {
2016-09-28 00:33:01 +08:00
Log.d(LOG_TAG, msg);
}
}
2016-09-30 10:41:40 +08:00
public static void shell(boolean root, String msg) {
if (logShell) {
Log.d(root ? "SU" : "SH", msg);
}
}
2016-09-21 16:55:20 -05:00
}