fix: 能谱log日志生产工具
This commit is contained in:
parent
cf39240cf0
commit
e2598e14ef
|
@ -35,6 +35,10 @@ public class MyLogFormatUtil {
|
|||
* 自动处理 log 开始
|
||||
*/
|
||||
public static final String analyseResultsBegin = "Sample Analyse Beginning at %1";
|
||||
/**
|
||||
* 自动处理 log 开始
|
||||
*/
|
||||
public static final String analyseResultsEnd = "Sample Analyse Successfully at %1";
|
||||
/**
|
||||
* 读取 calibration 开始
|
||||
*/
|
||||
|
@ -122,8 +126,8 @@ public class MyLogFormatUtil {
|
|||
int valueWidth = 25;
|
||||
|
||||
getBlockContext(data);
|
||||
Console.log(getContextTitleFormat("title","."));
|
||||
Console.log(getContextHeaderFormat("header","."));
|
||||
Console.log(getTitleFormat("title","."));
|
||||
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");
|
||||
|
@ -171,30 +175,53 @@ public class MyLogFormatUtil {
|
|||
|
||||
/**
|
||||
* 获取标题格式
|
||||
* 例: ....................................... XXX ........................................
|
||||
* <blockquote> 例: ....................................... XXX ........................................ </blockquote>
|
||||
* @param title
|
||||
* @param flag
|
||||
* @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;
|
||||
return String.format("%" + padding + "s%s%" + padding + "s", flag, title, flag).replace(" ",flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取页眉
|
||||
* 例: XXX.....
|
||||
* 获取标题格式, 符号默认"."
|
||||
* <blockquote> 例: ....................................... XXX ........................................ </blockquote>
|
||||
* @param title
|
||||
* @param flag
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取页眉, 符号默认"."
|
||||
* <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
|
||||
*/
|
||||
public static List<String> getBlockContext(Map<String, Object> data) {
|
||||
|
@ -289,4 +316,12 @@ public class MyLogFormatUtil {
|
|||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user