| | |
| | | package com.hdl.photovoltaic.other; |
| | | |
| | | |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.utils.TimeUtils; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public class HdlLogLogic { |
| | | |
| | | //是否需要打印到Logcat上(true不需要打印) |
| | | public static boolean isPrintLogcat = false; |
| | | //是否需要打印到Logcat上(false不需要打印) |
| | | public static boolean isPrintLogcat = true; |
| | | //默认打印标题 |
| | | private static final String title = "自定义输出打印信息:"; |
| | | |
| | | private static String logTitle = "自定义输出打印信息"+ (UserConfigManage.getInstance().isBAccount() ? "(B):" : "(C):"); |
| | | |
| | | /** |
| | | * java打印 |
| | | * |
| | | * @param content 自定义信息描述 |
| | | * @param customizeContentFormat 自定义内容格式 |
| | | */ |
| | | public static void print(String content) { |
| | | printBase(content, "0", false); |
| | | public static void print(String customizeContentFormat) { |
| | | printBase(customizeContentFormat, "0", false); |
| | | } |
| | | |
| | | /** |
| | | * java打印 |
| | | * |
| | | * @param content 自定义信息描述 |
| | | * @param isBoolean 是否加入内存(本地日志用到) |
| | | * @param customizeContentFormat 自定义内容格式 |
| | | * @param isAddToMemory 是否加入内存(本地日志用到) |
| | | */ |
| | | public static void print(String content, boolean isBoolean) { |
| | | printBase(content, "0", isBoolean); |
| | | public static void print(String customizeContentFormat, boolean isAddToMemory) { |
| | | printBase(customizeContentFormat, "0", isAddToMemory); |
| | | } |
| | | |
| | | /** |
| | | * java打印 |
| | | * |
| | | * @param msg 自定义信息描述 |
| | | * @param code 状态码 |
| | | * @param isBoolean 是否加入内存(本地日志用到) |
| | | * @param msg 自定义内容格式 |
| | | * @param code 状态码 |
| | | * @param isAddToMemory 是否加入内存(本地日志用到) |
| | | */ |
| | | public static void print(String msg, int code, boolean isBoolean) { |
| | | printBase(msg, code + "", isBoolean); |
| | | public static void print(String msg, int code, boolean isAddToMemory) { |
| | | printBase(msg, code + "", isAddToMemory); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * java打印和存储日志 |
| | | * |
| | | * @param msg 信息描述 |
| | | * @param code 状态 |
| | | * @param isBoolean 是否加入内存(本地日志用到) |
| | | * @param msg 信息描述 |
| | | * @param code 状态 |
| | | * @param isAddToMemory 是否加入内存(本地日志用到) |
| | | */ |
| | | private static void printBase(String msg, String code, boolean isBoolean) { |
| | | if (isPrintLogcat) { |
| | | return; |
| | | } |
| | | private static void printBase(String msg, String code, boolean isAddToMemory) { |
| | | CustomLogObject customLogObject = new CustomLogObject(); |
| | | customLogObject.msgOrData = msg; |
| | | customLogObject.code = code; |
| | | String json = title; |
| | | String json =logTitle; |
| | | json += customLogObject.getJointMessage(); |
| | | System.out.println(json); |
| | | if (isBoolean) { |
| | | if (isPrintLogcat) { |
| | | System.out.println(json); |
| | | } |
| | | if (isAddToMemory) { |
| | | writeLog(customLogObject.getJointMessage()); |
| | | } |
| | | } |