50 lines
1.2 KiB
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-07-16 01:20:39 +08:00
public static void debug(String line) {
Log.d(DEBUG_TAG, "DEBUG: " + line);
}
2017-05-31 17:43:55 +08:00
public static void debug(String fmt, Object... args) {
2017-07-16 01:20:39 +08:00
debug(String.format(Locale.US, fmt, args));
}
public static void error(String line) {
Log.e(MAIN_TAG, "MANAGERERROR: " + line);
2016-12-23 23:05:41 +08:00
}
2017-05-31 17:43:55 +08:00
public static void error(String fmt, Object... args) {
2017-07-16 01:20:39 +08:00
error(String.format(Locale.US, fmt, args));
2016-09-21 16:55:20 -05:00
}
2016-09-21 23:36:28 -05:00
2017-07-16 01:20:39 +08:00
public static void dev(String line) {
2017-02-07 02:01:32 +08:00
if (MagiskManager.devLogging) {
2017-07-16 01:20:39 +08:00
Log.d(DEBUG_TAG, line);
2016-09-28 00:33:01 +08:00
}
}
2017-07-16 01:20:39 +08:00
public static void dev(String fmt, Object... args) {
dev(String.format(Locale.US, fmt, args));
}
2017-07-18 03:34:06 +08:00
public static void shell(String line) {
2017-02-07 02:01:32 +08:00
if (MagiskManager.shellLogging) {
2017-07-18 03:34:06 +08:00
Log.d(DEBUG_TAG, "SHELL: " + line);
2016-09-30 10:41:40 +08:00
}
}
2017-07-16 01:20:39 +08:00
2017-07-18 03:34:06 +08:00
public static void shell(String fmt, Object... args) {
shell(String.format(Locale.US, fmt, args));
2017-07-16 01:20:39 +08:00
}
2016-09-21 16:55:20 -05:00
}