From 6139d9d4b4d42d43039fc5cec7c064d9cc20725b Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 19 十月 2023 17:10:37 +0800
Subject: [PATCH] 2023年10月19日17:10:30
---
app/src/main/java/com/hdl/photovoltaic/other/HdlLogLogic.java | 84 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 84 insertions(+), 0 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlLogLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlLogLogic.java
index 741a0b8..f7f64e7 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlLogLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlLogLogic.java
@@ -2,10 +2,18 @@
import android.util.Log;
+import com.google.gson.Gson;
+
/**
* 鏃ュ織閫昏緫
*/
public class HdlLogLogic {
+
+
+ /**
+ * 鏄惁闇�瑕佹墦鍗�(true涓嶉渶瑕佹墦鍗�)
+ */
+ public static boolean isDebug = false;
private static volatile HdlLogLogic sHdlLogLogic;
@@ -25,9 +33,85 @@
return sHdlLogLogic;
}
+ /**
+ * android鎵撳嵃
+ *
+ * @param tag 鏍囩
+ * @param mgs 閿欒淇℃伅
+ */
public static void print(String tag, String mgs) {
+ if (isDebug) {
+ return;
+ }
Log.d(tag, mgs);
}
+ /**
+ * java鎵撳嵃
+ *
+ * @param mgs 杈撳嚭淇℃伅
+ */
+ public static void print(String mgs) {
+ if (isDebug) {
+ return;
+ }
+ System.out.println(mgs);
+ }
+
+ /**
+ * java鎵撳嵃
+ *
+ * @param tag 鏍囬
+ * @param mgs 閿欒淇℃伅
+ * @param code 閿欒鐮�
+ */
+ public static void print(String tag, String mgs, int code) {
+ if (isDebug) {
+ return;
+ }
+// StringBuilder b = new StringBuilder();
+// b.append(title);
+// b.append(tag);
+// b.
+ 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 = "鑷畾涔夎緭鍑烘墦鍗颁俊鎭�:";
}
--
Gitblit v1.8.0