|
@@ -112,13 +112,13 @@ function getLastFile(dirPath, number, callback) {
|
|
// 读取日志(倒叙)指定行数
|
|
// 读取日志(倒叙)指定行数
|
|
function readLastNLines(dirPath, filePathList, n) {
|
|
function readLastNLines(dirPath, filePathList, n) {
|
|
const fileList = filePathList.map((item) => {
|
|
const fileList = filePathList.map((item) => {
|
|
- var path = dirPath + "/" + item
|
|
|
|
|
|
+ var filepath = dirPath + "/" + item
|
|
// 将相对路径转换为绝对路径
|
|
// 将相对路径转换为绝对路径
|
|
- const directoryPath = path.resolve(path);
|
|
|
|
|
|
+ const directoryPath = path.resolve(filepath);
|
|
logger.info("日志文件:" + directoryPath)
|
|
logger.info("日志文件:" + directoryPath)
|
|
let lines = [""]
|
|
let lines = [""]
|
|
if (checkFilePath(directoryPath)) {
|
|
if (checkFilePath(directoryPath)) {
|
|
- const content = fs.readFileSync(`${directoryPath}`, "utf8");
|
|
|
|
|
|
+ const content = fs.readFileSync(`${filepath}`, "utf8");
|
|
lines = content.trim().split("\n");
|
|
lines = content.trim().split("\n");
|
|
}
|
|
}
|
|
return {
|
|
return {
|