From 23b14b34438b229dfe1aa999ace05f741f61173a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 26 Nov 2014 13:28:10 -0500 Subject: [PATCH] moving nearly all startup messages to verbose type --- app.js | 10 +++++----- src/hotswap.js | 2 +- src/meta/js.js | 6 +++--- src/meta/sounds.js | 2 +- src/meta/templates.js | 4 ++-- src/notifications.js | 2 +- src/plugins.js | 27 ++++++++++----------------- 7 files changed, 23 insertions(+), 30 deletions(-) diff --git a/app.js b/app.js index af9683eb3f..768ac48c64 100644 --- a/app.js +++ b/app.js @@ -110,15 +110,15 @@ function start() { if (!cluster.isWorker || process.env.cluster_setup === 'true') { winston.info('Time: %s', (new Date()).toString()); winston.info('Initializing NodeBB v%s', pkg.version); - winston.info('* using configuration stored in: %s', configFile); + winston.verbose('* using configuration stored in: %s', configFile); } if (cluster.isWorker && process.env.cluster_setup === 'true') { var host = nconf.get(nconf.get('database') + ':host'), storeLocation = host ? 'at ' + host + (host.indexOf('/') === -1 ? ':' + nconf.get(nconf.get('database') + ':port') : '') : ''; - winston.info('* using %s store %s', nconf.get('database'), storeLocation); - winston.info('* using themes stored in: %s', nconf.get('themes_path')); + winston.verbose('* using %s store %s', nconf.get('database'), storeLocation); + winston.verbose('* using themes stored in: %s', nconf.get('themes_path')); } require('./src/database').init(function(err) { @@ -170,12 +170,12 @@ function start() { case 'js-propagate': meta.js.cache = message.cache; meta.js.map = message.map; - winston.info('[cluster] Client-side javascript and mapping propagated to worker %s', cluster.worker.id); + winston.verbose('[cluster] Client-side javascript and mapping propagated to worker %s', cluster.worker.id); break; case 'css-propagate': meta.css.cache = message.cache; meta.css.acpCache = message.acpCache; - winston.info('[cluster] Stylesheets propagated to worker %s', cluster.worker.id); + winston.verbose('[cluster] Stylesheets propagated to worker %s', cluster.worker.id); break; } }); diff --git a/src/hotswap.js b/src/hotswap.js index f852838550..608a6c27e0 100644 --- a/src/hotswap.js +++ b/src/hotswap.js @@ -25,7 +25,7 @@ HotSwap.replace = function(id, router) { if (idx) { delete stack[idx].handle; // Destroy the old router stack[idx].handle = router; // Replace with the new one - winston.info('[hotswap] Router with id `' + id + '` replaced successfully'); + winston.verbose('[hotswap] Router with id `' + id + '` replaced successfully'); } else { winston.warn('[hotswap] Could not find router in stack with hotswapId `' + id + '`'); } diff --git a/src/meta/js.js b/src/meta/js.js index b8ce5e2bbf..17f1b00269 100644 --- a/src/meta/js.js +++ b/src/meta/js.js @@ -135,7 +135,7 @@ module.exports = function(Meta) { process.exit(0); } - winston.info('[meta/js] Minification complete'); + winston.verbose('[meta/js] Minification complete'); minifier.kill(); if (cluster.isWorker) { @@ -204,7 +204,7 @@ module.exports = function(Meta) { async.apply(fs.writeFile, path.join(__dirname, '../../public/nodebb.min.js.map'), Meta.js.map) ], function (err) { if (!err) { - winston.info('[meta/js] Client-side minfile and mapping committed to disk.'); + winston.verbose('[meta/js] Client-side minfile and mapping committed to disk.'); emitter.emit('meta:js.compiled'); } else { winston.error('[meta/js] ' + err.message); @@ -219,7 +219,7 @@ module.exports = function(Meta) { fs.exists(scriptPath, function(exists) { if (exists) { if (!cluster.isWorker || process.env.cluster_setup === 'true') { - winston.info('[meta/js] (Experimental) Reading client-side scripts from file'); + winston.verbose('[meta/js] (Experimental) Reading client-side scripts from file'); async.map([scriptPath, mapPath], fs.readFile, function(err, files) { Meta.js.cache = files[0]; Meta.js.map = files[1]; diff --git a/src/meta/sounds.js b/src/meta/sounds.js index 9d1eb3e9be..90a78dfe1d 100644 --- a/src/meta/sounds.js +++ b/src/meta/sounds.js @@ -45,7 +45,7 @@ module.exports = function(Meta) { fs[process.platform !== 'win32' ? 'symlink' : 'link'](filePath, path.join(soundsPath, path.basename(filePath)), 'file', next); }, function(err) { if (!err) { - winston.info('[sounds] Sounds OK'); + winston.verbose('[sounds] Sounds OK'); } else { winston.error('[sounds] Could not initialise sounds: ' + err.message); } diff --git a/src/meta/templates.js b/src/meta/templates.js index 9fd6697aae..859a68627d 100644 --- a/src/meta/templates.js +++ b/src/meta/templates.js @@ -43,7 +43,7 @@ Templates.compile = function(callback) { if (err) { return callback(err); } - winston.info('[meta/templates] Compiling templates'); + winston.verbose('[meta/templates] Compiling templates'); rimraf.sync(viewsPath); mkdirp.sync(viewsPath); @@ -116,7 +116,7 @@ Templates.compile = function(callback) { winston.error('[meta/templates] ' + err.stack); } else { compileIndex(viewsPath, function() { - winston.info('[meta/templates] Successfully compiled templates.'); + winston.verbose('[meta/templates] Successfully compiled templates.'); emitter.emit('templates:compiled'); if (callback) { callback(); diff --git a/src/notifications.js b/src/notifications.js index 41296d2829..2de4ec1709 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -19,7 +19,7 @@ var async = require('async'), Notifications.init = function() { if (process.env.NODE_ENV === 'development') { - winston.info('[notifications.init] Registering jobs.'); + winston.verbose('[notifications.init] Registering jobs.'); } new cron('*/30 * * * *', Notifications.prune, null, true); }; diff --git a/src/plugins.js b/src/plugins.js index e926d19ec3..4d090d3df8 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -43,14 +43,12 @@ var fs = require('fs'), hotswap.prepare(nbbApp); if (global.env === 'development') { - winston.info('[plugins] Initializing plugins system'); + winston.verbose('[plugins] Initializing plugins system'); } Plugins.reload(function(err) { if (err) { - if (global.env === 'development') { - winston.info('[plugins] NodeBB encountered a problem while loading plugins', err.message); - } + winston.error('[plugins] NodeBB encountered a problem while loading plugins', err.message); return; } @@ -131,7 +129,7 @@ var fs = require('fs'), Plugins.fireHook('static:app.load', {app: app, router: router, middleware: middleware, controllers: controllers}, function() { hotswap.replace('plugins', router); - winston.info('[plugins] All plugins reloaded and rerouted'); + winston.verbose('[plugins] All plugins reloaded and rerouted'); callback(); }); }; @@ -252,7 +250,7 @@ var fs = require('fs'), // CSS Files for plugins if (pluginData.css && pluginData.css instanceof Array) { if (global.env === 'development') { - winston.info('[plugins] Found ' + pluginData.css.length + ' CSS file(s) for plugin ' + pluginData.id); + winston.verbose('[plugins] Found ' + pluginData.css.length + ' CSS file(s) for plugin ' + pluginData.id); } Plugins.cssFiles = Plugins.cssFiles.concat(pluginData.css.map(function(file) { @@ -266,7 +264,7 @@ var fs = require('fs'), // LESS files for plugins if (pluginData.less && pluginData.less instanceof Array) { if (global.env === 'development') { - winston.info('[plugins] Found ' + pluginData.less.length + ' LESS file(s) for plugin ' + pluginData.id); + winston.verbose('[plugins] Found ' + pluginData.less.length + ' LESS file(s) for plugin ' + pluginData.id); } Plugins.lessFiles = Plugins.lessFiles.concat(pluginData.less.map(function(file) { @@ -280,7 +278,7 @@ var fs = require('fs'), // Client-side scripts if (pluginData.scripts && pluginData.scripts instanceof Array) { if (global.env === 'development') { - winston.info('[plugins] Found ' + pluginData.scripts.length + ' js file(s) for plugin ' + pluginData.id); + winston.verbose('[plugins] Found ' + pluginData.scripts.length + ' js file(s) for plugin ' + pluginData.id); } Plugins.clientScripts = Plugins.clientScripts.concat(pluginData.scripts.map(function(file) { @@ -327,7 +325,7 @@ var fs = require('fs'), ], function(err) { if (!err) { if (global.env === 'development') { - winston.info('[plugins] Loaded plugin: ' + pluginData.id); + winston.verbose('[plugins] Loaded plugin: ' + pluginData.id); } callback(); } else { @@ -397,7 +395,6 @@ var fs = require('fs'), return callback(null, params); } - // if (global.env === 'development') winston.info('[plugins] Firing hook: \'' + hook + '\''); var hookType = hook.split(':')[0]; switch (hookType) { case 'filter': @@ -480,17 +477,13 @@ var fs = require('fs'), Plugins.toggleActive = function(id, callback) { Plugins.isActive(id, function(err, active) { if (err) { - if (global.env === 'development') { - winston.info('[plugins] Could not toggle active state on plugin \'' + id + '\''); - } + winston.warn('[plugins] Could not toggle active state on plugin \'' + id + '\''); return callback(err); } db[(active ? 'setRemove' : 'setAdd')]('plugins:active', id, function(err, success) { if (err) { - if (global.env === 'development') { - winston.info('[plugins] Could not toggle active state on plugin \'' + id + '\''); - } + winston.warn('[plugins] Could not toggle active state on plugin \'' + id + '\''); return callback(err); } @@ -757,7 +750,7 @@ var fs = require('fs'), for (var x=0,numPaths=paths.length;x