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

38 lines
965 B
Java
Raw Normal View History

2016-09-21 21:55:20 +00:00
package com.topjohnwu.magisk.utils;
import android.util.Log;
2017-05-31 09:43:55 +00:00
import java.util.Locale;
2016-09-21 21:55:20 +00:00
2017-05-31 09:43:55 +00:00
public class Logger {
2016-09-21 21:55:20 +00:00
2017-05-31 09:43:55 +00:00
public static final String DEBUG_TAG = "MagiskManager";
2017-10-13 19:31:48 +00:00
private static final boolean SHELL_LOGGING = false;
2017-01-25 08:45:55 +00:00
2017-07-15 17:20:39 +00:00
public static void debug(String line) {
Log.d(DEBUG_TAG, "DEBUG: " + line);
}
2017-05-31 09:43:55 +00:00
public static void debug(String fmt, Object... args) {
2017-07-15 17:20:39 +00:00
debug(String.format(Locale.US, fmt, args));
}
public static void error(String line) {
2017-10-13 19:31:48 +00:00
Log.e(DEBUG_TAG, "ERROR: " + line);
2016-12-23 15:05:41 +00:00
}
2017-05-31 09:43:55 +00:00
public static void error(String fmt, Object... args) {
2017-07-15 17:20:39 +00:00
error(String.format(Locale.US, fmt, args));
2016-09-21 21:55:20 +00:00
}
2016-09-22 04:36:28 +00:00
2017-10-19 12:37:58 +00:00
public static void shell(boolean in, String line) {
2017-10-13 19:31:48 +00:00
if (SHELL_LOGGING) {
2017-10-19 12:37:58 +00:00
Log.d(DEBUG_TAG, (in ? "SHELLIN : " : "SHELLOUT: ") + line);
2016-09-30 02:41:40 +00:00
}
}
2017-07-15 17:20:39 +00:00
2017-10-19 12:37:58 +00:00
public static void shell(boolean in, String fmt, Object... args) {
shell(in, String.format(Locale.US, fmt, args));
2017-07-15 17:20:39 +00:00
}
2016-09-21 21:55:20 +00:00
}