Added file logging
This commit is contained in:
20
hosts.js
20
hosts.js
@@ -5,7 +5,7 @@ var monitorInterval;
|
||||
|
||||
async function Monitoring() {
|
||||
await initHostList();
|
||||
console.log(`[${shared.now}] \nInizio monitoring`);
|
||||
Log(`[${shared.now}] \nInizio monitoring`);
|
||||
//monitora tutti gli host della lista
|
||||
shared.eventEmitter.on("tokenRenewalStart", () => {
|
||||
clearInterval(monitorInterval);
|
||||
@@ -38,7 +38,7 @@ async function isConnected(hostID) {
|
||||
},
|
||||
}
|
||||
);
|
||||
console.log(`[${shared.now}] ${hostID} connected: ${response.data.connected}`);
|
||||
Log(`[${shared.now}] ${hostID} connected: ${response.data.connected}`);
|
||||
return response.data.connected;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ async function initHostList() {
|
||||
hostIDs.push(host.id);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(
|
||||
Log(
|
||||
`[${shared.now}] Errore nella verifica e aggiunta al monitoraggio di un host: ${error}`
|
||||
);
|
||||
process.exit(3);
|
||||
@@ -88,7 +88,7 @@ async function initHostList() {
|
||||
);
|
||||
hostIDs.push(response.data[0].id);
|
||||
} catch (error) {
|
||||
console.log(
|
||||
Log(
|
||||
`[${shared.now}] Errore nella verifica e aggiunta al monitoraggio di un host: ${error}`
|
||||
);
|
||||
process.exit(3);
|
||||
@@ -115,7 +115,7 @@ async function initHostList() {
|
||||
);
|
||||
hostIDs.push(response.data.id);
|
||||
} catch (error) {
|
||||
console.log(
|
||||
Log(
|
||||
`[${shared.now}] Errore nella verifica e aggiunta al monitoraggio di un host: ${error}`
|
||||
);
|
||||
process.exit(3);
|
||||
@@ -134,7 +134,7 @@ async function initHostList() {
|
||||
);
|
||||
hostIDs.push(response.data.id);
|
||||
} catch (error) {
|
||||
console.log(
|
||||
Log(
|
||||
`[${shared.now}] Errore nella verifica e aggiunta al monitoraggio di un host: ${error}`
|
||||
);
|
||||
process.exit(3);
|
||||
@@ -142,7 +142,7 @@ async function initHostList() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log(
|
||||
Log(
|
||||
`[${shared.now}] Nessun peer specificato, verranno monitorati tutti i peer disponibili`
|
||||
);
|
||||
try {
|
||||
@@ -156,13 +156,13 @@ async function initHostList() {
|
||||
hostIDs.push(element.id);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(`[${shared.now}] ${error}`);
|
||||
Log(`[${shared.now}] ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`[${shared.now}] ID rilevati:`);
|
||||
Log(`[${shared.now}] ID rilevati:`);
|
||||
hostIDs.forEach((element) => {
|
||||
console.log(`[${shared.now}] ${element}`);
|
||||
Log(`[${shared.now}] ${element}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user