mac
2023-10-10 32b5f366ceaad4aa9a33eccf0b109eef24175495
app/src/main/java/com/hdl/photovoltaic/other/HdlLogLogic.java
@@ -2,6 +2,8 @@
import android.util.Log;
import com.google.gson.Gson;
/**
 * 日志逻辑
 */
@@ -35,7 +37,7 @@
     * android打印
     *
     * @param tag 标签
     * @param mgs 输出信息
     * @param mgs 错误信息
     */
    public static void print(String tag, String mgs) {
        if (isDebug) {
@@ -56,4 +58,56 @@
        System.out.println(mgs);
    }
    /**
     * java打印
     *
     * @param tag  标题
     * @param mgs  错误信息
     * @param code 错误码
     */
    public static void print(String tag, String mgs, int code) {
        if (isDebug) {
            return;
        }
        System.out.println(title + tag + "======" + mgs + "(" + code + ")");
    }
    /**
     * java打印
     *
     * @param tag  标题
     * @param mgs  错误信息
     * @param code 错误码
     */
    public static void print(String tag, String mgs, String code) {
        if (isDebug) {
            return;
        }
        System.out.println(title + tag + "======" + mgs + "(" + code + ")");
    }
    /**
     * java打印
     *
     * @param tag 标题
     * @param o   错误信息
     */
    public static void print(String tag, Object o) {
        if (isDebug) {
            return;
        }
        if (o == null) {
            System.out.println(title + tag);
        } else {
            try {
                System.out.println(title + tag + "======" + new Gson().toJson(o));
            } catch (Exception e) {
                System.out.println(title + tag + "======" + e.getMessage());
            }
        }
    }
    private static final String title = "自定义输出打印信息:";
}