|
@@ -7,7 +7,7 @@ const {logger, fileLogger} = require("./utils/logger");
|
|
|
const {spawn, exec, fork, execSync} = require("child_process");
|
|
|
const path = require("path");
|
|
|
|
|
|
-const {ka} = require("date-fns/locale");
|
|
|
+const {ka, tr} = require("date-fns/locale");
|
|
|
const {getAppMap} = require("./robot");
|
|
|
const crypto = require('crypto');
|
|
|
|
|
@@ -83,10 +83,12 @@ function init() {
|
|
|
const id = param.id
|
|
|
|
|
|
var port = -1;
|
|
|
+ var isFilePath = false;
|
|
|
robot.appMap.forEach((value, key) => {
|
|
|
// logger.info(JSON.stringify(value))
|
|
|
if (value.id + "" === id + "") {
|
|
|
port = value.port
|
|
|
+ isFilePath = value.isFilePath
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -95,16 +97,21 @@ function init() {
|
|
|
var logPath = "./logs" + port
|
|
|
// 将相对路径转换为绝对路径
|
|
|
const directoryPath = path.resolve(logPath);
|
|
|
- if (file.checkPathSync(directoryPath)) {
|
|
|
- logger.info(`日志相对地址:${logPath}`)
|
|
|
-
|
|
|
- file.getLastFile(logPath, 10, (fileNameList) => {
|
|
|
- logger.info('??1:', fileNameList);
|
|
|
- result = file.readLastNLines(logPath, fileNameList, n);
|
|
|
- // logger.info('?????:', result);
|
|
|
- res.send({'code': 200, 'data': result, "message": "SUCCESS"});
|
|
|
- });
|
|
|
+ if (isFilePath === false) {
|
|
|
+ if (file.checkPathSync(directoryPath)) {
|
|
|
+ var app_demo = robot.getApp(value.id + "");
|
|
|
+ app_demo.isFilePath = true
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ logger.info(`日志相对地址:${logPath}`)
|
|
|
+
|
|
|
+ file.getLastFile(logPath, 10, (fileNameList) => {
|
|
|
+ logger.info('??1:', fileNameList);
|
|
|
+ result = file.readLastNLines(logPath, fileNameList, n);
|
|
|
+ // logger.info('?????:', result);
|
|
|
+ res.send({'code': 200, 'data': result, "message": "SUCCESS"});
|
|
|
+ });
|
|
|
} else {
|
|
|
res.send({'code': 200, 'data': result, "message": "SUCCESS"});
|
|
|
}
|