From c13cb54d0b9f9b2c73f213b6cdb163f462fd64c7 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期五, 13 十月 2023 18:17:59 +0800 Subject: [PATCH] 2023年10月13日18:17:52 --- app/src/main/java/com/hdl/photovoltaic/other/HdlLogLogic.java | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 59 insertions(+), 1 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 1a4d07c..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,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,60 @@ 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