diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-05-01 15:55:27 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-05-01 15:55:27 +0200 |
commit | 2c29fb241f36c490d8329e3578afb01eb31a14ae (patch) | |
tree | fa381e8280dfedd5357f1f216b5fcca156a0c976 /lib/utils | |
parent | 77dc11bcc2cb8976552ec1f2ef17a4ecdafef9ad (diff) | |
download | gitbook-2c29fb241f36c490d8329e3578afb01eb31a14ae.zip gitbook-2c29fb241f36c490d8329e3578afb01eb31a14ae.tar.gz gitbook-2c29fb241f36c490d8329e3578afb01eb31a14ae.tar.bz2 |
Always log timing infos
Diffstat (limited to 'lib/utils')
-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 = { |