diff options
-rw-r--r-- | lib/utils/logger.js | 9 | ||||
-rw-r--r-- | lib/utils/timing.js | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/utils/logger.js b/lib/utils/logger.js index 3bde904..6fac92b 100644 --- a/lib/utils/logger.js +++ b/lib/utils/logger.js @@ -60,6 +60,15 @@ Logger.prototype.setLevel = function(logLevel) { }; /** + Return minimum logging level + + @return {Number} +*/ +Logger.prototype.getLevel = function(logLevel) { + return this.logLevel; +}; + +/** Print a simple string @param {String} diff --git a/lib/utils/timing.js b/lib/utils/timing.js index 21a4b91..9903af2 100644 --- a/lib/utils/timing.js +++ b/lib/utils/timing.js @@ -64,6 +64,10 @@ function dump(logger) { var measured = 0; var totalDuration = Date.now() - startDate; + // Enable debug logging + var logLevel = logger.getLevel(); + logger.setLevel('debug'); + Immutable.Map(timers) .valueSeq() .sortBy(function(timer) { @@ -81,6 +85,9 @@ function dump(logger) { logger.debug.ln(time(totalDuration - measured) + ' spent in non-mesured sections'); + + // Rollback to previous level + logger.setLevel(logLevel); } module.exports = { |