|
@@ -103,11 +103,14 @@ function getLastFile(dirPath, number, callback) {
|
|
|
for (file of files) {
|
|
|
const filePath = path.join(dirPath, file);
|
|
|
const stats = await fs.promises.stat(filePath);
|
|
|
- fileList.push({name: file, time: stats.mtimeMs});
|
|
|
- // logger.info("文件:" +filePath+"时间:"+stats.birthtime.getTime())
|
|
|
+ fileList.push({name: file, time: stats.birthtime.getTime()});
|
|
|
+ // logger.info("文件:" + filePath + "时间:" + stats.birthtime.getTime())
|
|
|
}
|
|
|
|
|
|
fileList.sort((a, b) => b.time - a.time);
|
|
|
+ // for (a of fileList) {
|
|
|
+ // logger.info("文件cccccccc22222222:" + a.name + "\ttime:" + a.time)
|
|
|
+ // }
|
|
|
lastFileList = fileList.slice(0, number != -1 ? number : fileList.length);
|
|
|
lastFileNameList = lastFileList.map((item) => item.name);
|
|
|
|
|
@@ -119,7 +122,10 @@ function getLastFile(dirPath, number, callback) {
|
|
|
// 读取日志(倒叙)指定行数
|
|
|
function readLastNLines(dirPath, filePathList, n) {
|
|
|
try {
|
|
|
-
|
|
|
+ // for (var i = 0; i < filePathList.length; i++) {
|
|
|
+ // var item = filePathList[i];
|
|
|
+ // logger.info("日志文件2222222:" + item)
|
|
|
+ // }
|
|
|
|
|
|
const fileList = [];
|
|
|
var count = 0;
|
|
@@ -147,7 +153,6 @@ function readLastNLines(dirPath, filePathList, n) {
|
|
|
return lastNLines.split("\n").reverse();
|
|
|
} catch (e) {
|
|
|
logger.info('获取日志异常了~~1111111111111111', e);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|