hl 5 mesiacov pred
rodič
commit
e71bf1754a
2 zmenil súbory, kde vykonal 6 pridanie a 3 odobranie
  1. 1 0
      src/utils/file.js
  2. 5 3
      src/web.js

+ 1 - 0
src/utils/file.js

@@ -93,6 +93,7 @@ function delFile() {
 /***********************************/
 function getLastFile(dirPath, number, callback) {
     fs.readdir(dirPath, async (err, files) => {
+        logger.info(`---------------------4`)
         if (err) {
             logger.error(`无法列出目录。`, err);
             // process.exit(1);

+ 5 - 3
src/web.js

@@ -91,14 +91,17 @@ function init() {
             // 将相对路径转换为绝对路径
             const directoryPath = path.resolve(logPath);
             try {
+                logger.info(`---------------------2`)
                 file.checkPathSync(directoryPath)
-
+                logger.info(`---------------------3`)
                 file.getLastFile(logPath, 5, async (fileNameList, _) => {
+                    logger.info(`---------------------5`)
                     // logger.info('cccccccccccccc文件:', fileNameList);
                     // result = await file.readLastNLines(logPath, fileNameList, n);
                     result =  await  file.getRecentLogs(logPath,fileNameList.reverse(),n);
 
                     // logger.info('?????:', result);
+                    logger.info(`---------------------6`)
                     res.send({'code': 200, 'data': result, "message": "SUCCESS"});
                 });
             } catch (e) {
@@ -129,7 +132,6 @@ function init() {
     })
     //启动-仓位检查
     app.get('/searchPositions', (req, res) => {
-        logger.info(`---------------------2`)
         const param = req.query;
         logger.info(JSON.stringify(param));
         robot.searchPositions(param)
@@ -137,7 +139,7 @@ function init() {
     })
     // 新策略-返回机器人状态
     app.get('/predictorState', (req, res) => {
-        logger.info(`---------------------3`)
+
         // const param = req.query;
         // logger.info(JSON.stringify(param));
         // let data = robot.predictorState(param)