Browse Source

日志查询bug尝试修复

hl 1 year ago
parent
commit
cb1df8d49b
1 changed files with 6 additions and 7 deletions
  1. 6 7
      src/web.js

+ 6 - 7
src/web.js

@@ -33,18 +33,17 @@ function init() {
         const n = param.n
         const id = param.id
 
+        var port = -1;
         robot.appMap.forEach((value, key) => {
             logger.info(JSON.stringify(value))
-
+            if (value.id === id) {
+                port = value.port
+            }
         })
-        var app = robot.getApp(id)
-        // logger.info(JSON.stringify(getAppMap()))
-        // logger.info(JSON.stringify(app))
-        logger.info(`当前参数:${id}-${n}-??${app.port}`);
 
         let result = [];
-        if (app.port !== -1) {
-            var logPath = "./logs" + app.port
+        if (port !== -1) {
+            var logPath = "./logs" + port
             logger.info(`日志相对地址:${logPath}`)
 
             file.getLastFile(logPath, 10, (fileNameList) => {