diff --git a/src/index.ts b/src/index.ts index 4616e96..1531b60 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,11 +13,10 @@ class Uptime { console.log('Starting...'); console.log(`Starting at ${this.startTime.toLocaleDateString()} ${this.startTime.toLocaleTimeString()}`); this.handle(); - setInterval(() => this.handle(), 1000 * 30); + setInterval(() => this.handle(), 1000 * 10); } async handle() { - console.log('Fetch status...') await ping.sys.probe('node.under-scape.com', (isAlive) => { const now = new Date(); this.totalIte++; @@ -35,7 +34,7 @@ class Uptime { }); } - console.log(`[${now.toLocaleDateString()} ${now.toLocaleTimeString()}] Total: ${this.totalIte} Up: ${this.totalUp} Down: ${this.totalDown} Uptime: ${Math.round((this.totalUp / this.totalIte) * 100)}%`) + process.stdout.write(`[${now.toLocaleDateString()} ${now.toLocaleTimeString()}] Total: ${this.totalIte} Up: ${this.totalUp} Down: ${this.totalDown} Uptime: ${Math.round((this.totalUp / this.totalIte) * 100)}%\r`) }, {timeout: 10}); } }