Browse Source

global

master
zeus 4 years ago
parent
commit
f185156a30
  1. 25
      swarmlab-app/src/run/app.js

25
swarmlab-app/src/run/app.js

@ -267,11 +267,15 @@ app.post('/run', [
], ],
cors(corsOptions), (req, res, next) => { cors(corsOptions), (req, res, next) => {
(async() => {
//console.log(JSON.stringify(req.headers)); //console.log(JSON.stringify(req.headers));
//console.log(JSON.stringify(req.body)); //console.log(JSON.stringify(req.body));
console.log("mongo "+JSON.stringify(req.body)); console.log("mongo "+JSON.stringify(req.body));
console.log("LOG "+JSON.stringify(req.body[0].message)); console.log("LOG "+JSON.stringify(req.body[0].message));
console.log("PATH "+JSON.stringify(req.body[0].tailed_path)); console.log("PATH "+JSON.stringify(req.body[0].tailed_path));
var getpath = await onlogfile(req.body[0].tailed_path)
for (var i = 0; i < req.body.length; i++){ for (var i = 0; i < req.body.length; i++){
var obj = req.body[i]; var obj = req.body[i];
@ -282,17 +286,6 @@ cors(corsOptions), (req, res, next) => {
var reslog = new Object(); var reslog = new Object();
reslog.log = obj reslog.log = obj
//reslog.test = usersession.SOCKET.user
//var n = {}
//n.year = now.getFullYear();
//n.month = now.getMonth();
//n.day = now.getDay();
//n.hours = now.getHours();
//n.minutes = now.getMinutes();
//n.seconds = now.getSeconds();
//n.milliseconds = now.getMilliseconds();
//reslog.date = n
reslog.date = convertDateToUTC(now) reslog.date = convertDateToUTC(now)
console.log(reslog); console.log(reslog);
var pathfileval = pathmodule.basename(reslog.log.tailed_path); var pathfileval = pathmodule.basename(reslog.log.tailed_path);
@ -304,16 +297,8 @@ cors(corsOptions), (req, res, next) => {
console.log("IOTuser "+JSON.stringify(global.pipelines)); console.log("IOTuser "+JSON.stringify(global.pipelines));
// io.in("iot").emit("message", reslog); // io.in("iot").emit("message", reslog);
// io.emit("logdata", reslog); // io.emit("logdata", reslog);
/*
for (var key in obj){
var value = obj[key];
//console.log("line " + key + ": " + value);
reslog.key = key
reslog.value = value
//io.emit("logdata", reslog);
}
*/
} }
})()
//io.in("iot").emit("message", RES); //io.in("iot").emit("message", RES);

Loading…
Cancel
Save