fix: 能谱log日志生产工具

This commit is contained in:
orgin 2023-09-18 17:16:24 +08:00
parent cf39240cf0
commit e2598e14ef

View File

@ -35,6 +35,10 @@ public class MyLogFormatUtil {
* 自动处理 log 开始 * 自动处理 log 开始
*/ */
public static final String analyseResultsBegin = "Sample Analyse Beginning at %1"; public static final String analyseResultsBegin = "Sample Analyse Beginning at %1";
/**
* 自动处理 log 开始
*/
public static final String analyseResultsEnd = "Sample Analyse Successfully at %1";
/** /**
* 读取 calibration 开始 * 读取 calibration 开始
*/ */
@ -122,8 +126,8 @@ public class MyLogFormatUtil {
int valueWidth = 25; int valueWidth = 25;
getBlockContext(data); getBlockContext(data);
Console.log(getContextTitleFormat("title",".")); Console.log(getTitleFormat("title","."));
Console.log(getContextHeaderFormat("header",".")); Console.log(getHeaderFormat("header","."));
List<String> channels = Arrays.asList("59.541", "88.034", "122.061", "165.857", "391.698", "661.657", "834.838", "898.036", "1115.540", "1173.230", "1332.490", "1836.050"); List<String> channels = Arrays.asList("59.541", "88.034", "122.061", "165.857", "391.698", "661.657", "834.838", "898.036", "1115.540", "1173.230", "1332.490", "1836.050");
@ -171,30 +175,53 @@ public class MyLogFormatUtil {
/** /**
* 获取标题格式 * 获取标题格式
* ....................................... XXX ........................................ * <blockquote> ....................................... XXX ........................................ </blockquote>
* @param title * @param title
* @param flag * @param flag
* @return * @return
*/ */
public static String getContextTitleFormat(String title, String flag) { public static String getTitleFormat(String title, String flag) {
int padding = (CONTEXT_TITLE_SIZE - title.length()) / 2; int padding = (CONTEXT_TITLE_SIZE - title.length()) / 2;
return String.format("%" + padding + "s%s%" + padding + "s", flag, title, flag).replace(" ",flag); return String.format("%" + padding + "s%s%" + padding + "s", flag, title, flag).replace(" ",flag);
} }
/** /**
* 获取页眉 * 获取标题格式, 符号默认"."
* XXX..... * <blockquote> ....................................... XXX ........................................ </blockquote>
* @param title * @param title
* @param flag
* @return * @return
*/ */
public static String getContextHeaderFormat(String title, String flag) { public static String getTitleFormat(String title) {
int padding = (CONTEXT_TITLE_SIZE - title.length()) / 2;
return String.format("%" + padding + "s%s%" + padding + "s", CONTEXT_TITLE_FLAG, title, CONTEXT_TITLE_FLAG)
.replace(" ",CONTEXT_TITLE_FLAG);
}
/**
* 获取页眉
* <blockquote> XXX..... </blockquote>
* @param title 内容
* @param flag 符号
* @return
*/
public static String getHeaderFormat(String title, String flag) {
return String.format("%s%" + CONTEXT_HEADER_SIZE + "s", title, flag, "\n").replace(" ",flag); return String.format("%s%" + CONTEXT_HEADER_SIZE + "s", title, flag, "\n").replace(" ",flag);
} }
/**
* 获取页眉, 符号默认"."
* <blockquote> XXX..... </blockquote>
* @param title 内容
* @return
*/
public static String getHeaderFormat(String title) {
return String.format("%s%" + CONTEXT_HEADER_SIZE + "s", title, FILE_TITLE_FLAG, "\n")
.replace(" ", FILE_TITLE_FLAG);
}
/** /**
* 获取内容正文 * 获取内容正文
* @param data * @param data 内容
* @return * @return
*/ */
public static List<String> getBlockContext(Map<String, Object> data) { public static List<String> getBlockContext(Map<String, Object> data) {
@ -289,4 +316,12 @@ public class MyLogFormatUtil {
} }
return result; return result;
} }
public static List<String> getPass(List<String> source) {
List<String> result = Lists.newLinkedList();
for (String str : source) {
result.add(str.contains("0") ? "Fail" : "Pass");
}
return result;
}
} }