From de2cc1fd9d41c76bab08301f74dabd2ef807d3c2 Mon Sep 17 00:00:00 2001 From: zeus Date: Mon, 23 Nov 2020 22:48:05 +0200 Subject: [PATCH] global --- swarmlab-app/src/run/app.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index fee1bf2..7ccff58 100755 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -189,6 +189,10 @@ async function getpipelines(token,pipelinename) { global.online='ob'; global.pipelines=[]; + function sendlog(reslog,index){ + //io.in("iot").emit("message", reslog); + console.info(reslog); + } function onWatcherReady(){ console.info('From here can you check for real changes, the initial scan has been completed.'); } @@ -311,7 +315,11 @@ cors(corsOptions), (req, res, next) => { reslog.date = convertDateToUTC(now) console.log(reslog); + var pathfileval = pathmodule.basename(reslog.log.tailed_path); + var indexfind = global.pipelines.findIndex(x => x.pathlogfile==pathfileval); + indexfind === 1 ? sendlog(reslog, indexfind) : console.log("object already exists") console.log("IOT "+JSON.stringify(reslog.log.tailed_path)); + console.log("IOTindexfind "+JSON.stringify(indexfind)); console.log("IOTuser "+JSON.stringify(global.pipelines)); // io.in("iot").emit("message", reslog); // io.emit("logdata", reslog);