|
@@ -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});
|
|
|
-
|
|
|
+ fileList.push({name: file, time: stats.birthtime.getTime()});
|
|
|
+
|
|
|
}
|
|
|
|
|
|
fileList.sort((a, b) => b.time - 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 {
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
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);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|