diff --git a/CHANGELOG.md b/CHANGELOG.md index fcc86c7c6..9a51b63ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ +## 4.0.1 + +- chore: switch Systeminfo logging to debug + ## 4.0.0 - feat: make pm2 fully standalone with node embedded diff --git a/lib/Sysinfo/SystemInfo.js b/lib/Sysinfo/SystemInfo.js index b935b583e..36d022f9c 100644 --- a/lib/Sysinfo/SystemInfo.js +++ b/lib/Sysinfo/SystemInfo.js @@ -7,6 +7,7 @@ const fork = require('child_process').fork const DEFAULT_CONVERSION = 1024 * 1024 const os = require('os') const fs = require('fs') +const debug = require('debug')('pm2:sysinfos') class SystemInfo { constructor() { @@ -102,10 +103,10 @@ class SystemInfo { stdio: ['inherit', 'inherit', 'inherit', 'ipc'] }) - this.process.on('exit', () => { - console.log('systeminfos collection process offline') + this.process.on('exit', (code) => { + console.log(`systeminfos collection process offline with code ${code}`) if (this.restart == true) - this.fork() + this.fork() }) this.process.on('error', (e) => { @@ -229,7 +230,7 @@ class SystemInfo { .then(getOsInfo) .then(diskLayout) .catch(e => { - console.error(`Error when trying to retrieve static informations`, e) + debug(`Error when trying to retrieve static informations`, e) }) } @@ -257,12 +258,12 @@ class SystemInfo { next() }) .catch(e => { - console.error(e) + debug(e) next() }) }, (err) => { if (err) - console.error(err) + debug(err) this.infos.containers = new_containers.sort((a, b) => { var textA = a.name.toUpperCase(); var textB = b.name.toUpperCase(); @@ -272,7 +273,7 @@ class SystemInfo { }) }) .catch(e => { - console.error(e) + debug(e) return cb() }) } @@ -284,7 +285,7 @@ class SystemInfo { this.infos.services.stopped = services.filter(service => service.running === false) }) .catch(e => { - console.error(e) + debug(e) }) } @@ -300,7 +301,7 @@ class SystemInfo { return cb() }) .catch(e => { - console.error(`Error when retrieving process list`, e) + debug(`Error when retrieving process list`, e) return cb() }) } @@ -366,7 +367,7 @@ class SystemInfo { return cb() }) .catch(e => { - console.error(`Error while getting memory info`, e) + debug(`Error while getting memory info`, e) return cb() }) } @@ -383,7 +384,7 @@ class SystemInfo { setTimeout(retrieveConn.bind(this), 10 * 1000) }) .catch(e => { - console.error(`Error while retrieving filesystem infos`, e) + debug(`Error while retrieving filesystem infos`, e) setTimeout(retrieveConn.bind(this), 10 * 1000) }) })(); @@ -403,7 +404,7 @@ class SystemInfo { setTimeout(fsSizeCollection.bind(this), 30 * 1000) }) .catch(e => { - console.error(`Error while retrieving filesystem infos`, e) + debug(`Error while retrieving filesystem infos`, e) setTimeout(fsSizeCollection.bind(this), 10 * 1000) }) })(); @@ -428,7 +429,7 @@ class SystemInfo { setTimeout(ioCollection.bind(this), 1000) }) .catch(e => { - console.error(`Error while getting network statistics`, e) + debug(`Error while getting network statistics`, e) setTimeout(ioCollection.bind(this), 1000) }) })(); @@ -464,7 +465,7 @@ class SystemInfo { setTimeout(latencyCollection.bind(this), 2000) }) .catch(e => { - console.error(e) + debug(e) setTimeout(latencyCollection.bind(this), 2000) }) })() @@ -508,7 +509,7 @@ class SystemInfo { setTimeout(networkStatsCollection.bind(this), 1000) }) .catch(e => { - console.error(`Error on retrieving network stats`, e) + debug(`Error on retrieving network stats`, e) setTimeout(networkStatsCollection.bind(this), 900) }) })() diff --git a/package.json b/package.json index 36cd9601a..292a58db7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pm2", "preferGlobal": true, - "version": "4.0.0", + "version": "4.0.1", "engines": { "embed": "12.4.0", "node": ">=8.0.0"