34 lines
979 B
Java
Raw Normal View History

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
2017-05-31 17:43:55 +08:00
import java.util.Locale;
2016-09-21 16:55:20 -05:00
2017-05-31 17:43:55 +08:00
public class Logger {
2016-09-21 16:55:20 -05:00
2017-05-31 17:43:55 +08:00
public static final String MAIN_TAG = "Magisk";
public static final String DEBUG_TAG = "MagiskManager";
2017-01-25 16:45:55 +08:00
2017-05-31 17:43:55 +08:00
public static void debug(String fmt, Object... args) {
Log.d(DEBUG_TAG, "DEBUG: " + String.format(Locale.US, fmt, args));
2016-12-23 23:05:41 +08:00
}
2017-05-31 17:43:55 +08:00
public static void error(String fmt, Object... args) {
Log.e(MAIN_TAG, "MANAGERERROR: " + String.format(Locale.US, fmt, args));
2016-09-21 16:55:20 -05:00
}
2016-09-21 23:36:28 -05:00
2017-05-31 17:43:55 +08:00
public static void dev(String fmt, Object... args) {
2017-02-07 02:01:32 +08:00
if (MagiskManager.devLogging) {
2017-05-31 17:43:55 +08:00
Log.d(DEBUG_TAG, String.format(Locale.US, fmt, args));
2016-09-28 00:33:01 +08:00
}
}
2017-05-31 17:43:55 +08:00
public static void shell(boolean root, String fmt, Object... args) {
2017-02-07 02:01:32 +08:00
if (MagiskManager.shellLogging) {
2017-05-31 17:43:55 +08:00
Log.d(DEBUG_TAG, (root ? "MANAGERSU: " : "MANAGERSH: ") + String.format(Locale.US, fmt, args));
2016-09-30 10:41:40 +08:00
}
}
2016-09-21 16:55:20 -05:00
}