Browse Source

remove console logs

master
filesite-io 6 months ago
parent
commit
7e97fb5a79
  1. 10
      monitor.mjs

10
monitor.mjs

@ -70,7 +70,7 @@ class Monitor {
const cronjob = cron.schedule(`*/${frequence} * * * *`, async () => { const cronjob = cron.schedule(`*/${frequence} * * * *`, async () => {
let configs = await _self.getConfig(); let configs = await _self.getConfig();
if (configs.monit_urls.length == 0) { if (configs.monit_urls.length == 0) {
console.error("No monit urls"); console.error("No monit urls in the config file.");
return false; return false;
} }
@ -83,7 +83,6 @@ class Monitor {
taskRes = await common.createHeroUnionTask(configs.monit_urls[i], '', configs); taskRes = await common.createHeroUnionTask(configs.monit_urls[i], '', configs);
if (taskRes && taskRes.code == 1) { if (taskRes && taskRes.code == 1) {
_self.tasks.push(taskRes.task); _self.tasks.push(taskRes.task);
console.log("Monit task", taskRes.task);
}else { }else {
console.error("Monit task create failed", taskRes); console.error("Monit task create failed", taskRes);
} }
@ -100,17 +99,14 @@ class Monitor {
const _self = this; const _self = this;
let configs = await _self.getConfig(); let configs = await _self.getConfig();
console.log('Task number', _self.tasks.length);
let task, taskRes; let task, taskRes;
for(let index = 0; index < _self.tasks.length; index ++) { for(let index = 0; index < _self.tasks.length; index ++) {
task = _self.tasks[index]; task = _self.tasks[index];
if (task.status == 'done') {continue;} if (task.status == 'done') {continue;}
console.log('Query task result', task); console.log('Query task result of %s', task.id);
taskRes = await common.queryHeroUnionTask(task.id, configs); taskRes = await common.queryHeroUnionTask(task.id, configs);
if (taskRes && taskRes.code == 1) { if (taskRes && taskRes.code == 1) {
console.log("Task result", taskRes);
_self.tasks[index] = taskRes.task; _self.tasks[index] = taskRes.task;
common.log('Connect success, url: %s, task id: %s', task.url, task.id); common.log('Connect success, url: %s, task id: %s', task.url, task.id);
@ -142,7 +138,7 @@ class Monitor {
&& this.config.resultQueryFrequence ? this.config.resultQueryFrequence : 5; //5 分钟检测一次 && this.config.resultQueryFrequence ? this.config.resultQueryFrequence : 5; //5 分钟检测一次
const cronjob = cron.schedule(`*/${frequence} * * * *`, async () => { const cronjob = cron.schedule(`*/${frequence} * * * *`, async () => {
if (_self.tasks.length == 0) { if (_self.tasks.length == 0) {
console.error("No tasks"); console.error("No tasks to check result.");
return false; return false;
} }

Loading…
Cancel
Save