Magisk/app/src/main/java/com/topjohnwu/magisk/utils/Logger.java

39 lines
996 B
Java
Raw Normal View History

2016-09-21 21:55:20 +00:00
package com.topjohnwu.magisk.utils;
import android.util.Log;
2017-01-25 05:16:50 +00:00
import com.topjohnwu.magisk.Global;
2016-09-21 21:55:20 +00:00
public class Logger {
2016-12-23 15:05:41 +00:00
public static final String TAG = "Magisk";
public static final String DEV_TAG = "Magisk: DEV";
public static final String DEBUG_TAG = "Magisk: DEBUG";
2016-09-21 21:55:20 +00:00
2016-12-23 15:05:41 +00:00
public static void debug(String msg) {
Log.d(DEBUG_TAG, msg);
}
2016-09-27 16:33:01 +00:00
public static void dev(String msg, Object... args) {
2017-01-25 05:16:50 +00:00
if (Global.Configs.devLogging) {
2016-09-21 21:55:20 +00:00
if (args.length == 1 && args[0] instanceof Throwable) {
2016-12-23 15:05:41 +00:00
Log.d(DEV_TAG, msg, (Throwable) args[0]);
2016-09-21 21:55:20 +00:00
} else {
2016-12-23 15:05:41 +00:00
Log.d(DEV_TAG, String.format(msg, args));
2016-09-21 21:55:20 +00:00
}
}
}
2016-09-22 04:36:28 +00:00
2016-09-27 16:33:01 +00:00
public static void dev(String msg) {
2017-01-25 05:16:50 +00:00
if (Global.Configs.devLogging) {
2016-12-23 15:05:41 +00:00
Log.d(DEV_TAG, msg);
2016-09-27 16:33:01 +00:00
}
}
2016-09-30 02:41:40 +00:00
public static void shell(boolean root, String msg) {
2017-01-25 05:16:50 +00:00
if (Global.Configs.shellLogging) {
2016-09-30 02:41:40 +00:00
Log.d(root ? "SU" : "SH", msg);
}
}
2016-09-21 21:55:20 +00:00
}