|
@@ -137,17 +137,8 @@ function readLastNLines(dirPath, filePathList, n) {
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
- // const fileList = filePathList.map((item) => {
|
|
|
- // var filepath = dirPath + "/" + item
|
|
|
- //
|
|
|
- // logger.info("日志文件:" + filepath)
|
|
|
- // const content = fs.readFileSync(`${filepath}`, "utf8");
|
|
|
- // let lines = content.trim().split("\n");
|
|
|
- // return {
|
|
|
- // filePath: item,
|
|
|
- // lines: lines,
|
|
|
- // };
|
|
|
- // });
|
|
|
+ fileList.reverse();
|
|
|
+
|
|
|
const allFile = [].concat(...fileList.map((item) => item.lines));
|
|
|
let lastNLines = allFile.slice(-n).join("\n");
|
|
|
return lastNLines.split("\n").reverse();
|