|
@@ -100,7 +100,7 @@ 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.mtimeMs});
|
|
|
}
|
|
|
fileList.sort((a, b) => b.time - a.time);
|
|
|
lastFileList = fileList.slice(0, number != -1 ? number : fileList.length);
|
|
@@ -112,6 +112,7 @@ function getLastFile(dirPath, number, callback) {
|
|
|
// 读取日志(倒叙)指定行数
|
|
|
function readLastNLines(dirPath, filePathList, n) {
|
|
|
const fileList = filePathList.map((item) => {
|
|
|
+ logger.info("日志文件:" + dirPath + "/" + item)
|
|
|
const content = fs.readFileSync(`${dirPath}/${item}`, "utf8");
|
|
|
const lines = content.trim().split("\n");
|
|
|
return {
|