From d1916f40962b2cc8a1866172eab7d5d89db093be Mon Sep 17 00:00:00 2001 From: Alexandre Strzelewicz Date: Fri, 2 Feb 2018 11:27:33 +0100 Subject: [PATCH] refactor: no more interactive spinner for connection to KM + change pm2 log format + remove some logs --- lib/God.js | 2 +- lib/Interactor/InteractorDaemonizer.js | 6 +----- lib/Utility.js | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/God.js b/lib/God.js index 8df9b7f5a..a7dd8c3d5 100644 --- a/lib/God.js +++ b/lib/God.js @@ -359,7 +359,7 @@ God.handleExit = function handleExit(clu, exit_code, kill_signal) { God.notify('exit', proc); if (God.pm2_being_killed) { - console.log('[HandleExit] PM2 is being killed, stopping restart procedure...'); + //console.log('[HandleExit] PM2 is being killed, stopping restart procedure...'); return false; } diff --git a/lib/Interactor/InteractorDaemonizer.js b/lib/Interactor/InteractorDaemonizer.js index c50905ddd..2d87715ff 100644 --- a/lib/Interactor/InteractorDaemonizer.js +++ b/lib/Interactor/InteractorDaemonizer.js @@ -232,7 +232,7 @@ var daemonize = function(conf, infos, cb) { stdio : ['ipc', out, err] }); - UX.processing.start(); + console.log('[KM] Connecting'); fs.writeFileSync(conf.INTERACTOR_PID_PATH, child.pid); @@ -246,8 +246,6 @@ var daemonize = function(conf, infos, cb) { child.unref(); var t = setTimeout(function() { - UX.processing.stop(); - Common.printOut(cst.PREFIX_MSG_WARNING + ' Not managed to connect to Keymetrics, retrying in background. (check %s)', cst.INTERACTOR_LOG_FILE_PATH); child.removeAllListeners('message'); child.removeAllListeners('error'); @@ -259,8 +257,6 @@ var daemonize = function(conf, infos, cb) { clearTimeout(t); debug('Interactor daemon launched', msg); - UX.processing.stop(); - if (msg.debug) { return cb(null, msg, child); } diff --git a/lib/Utility.js b/lib/Utility.js index 169d86fd8..a6f1f318e 100644 --- a/lib/Utility.js +++ b/lib/Utility.js @@ -84,7 +84,7 @@ var Utility = module.exports = { // Generate timestamp prefix function timestamp(){ - return moment().format(cst.PM2_LOG_DATE_FORMAT) + ': '; + return '[' + moment().format(cst.PM2_LOG_DATE_FORMAT) + ']'; } var hacks = ['info', 'log', 'error', 'warn'], consoled = {}; @@ -108,7 +108,7 @@ var Utility = module.exports = { }); } // do not destroy variable insertion - arguments[0] && (arguments[0] = timestamp() + arguments[0]); + arguments[0] && (arguments[0] = timestamp() + ' PM2 ' + k + ': ' + arguments[0]); consoled[k].apply(console, arguments); }; });