diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-02-04 16:54:02 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-02-04 16:54:02 +0100 |
commit | 234a37726fe895f59f8fc0329ea4d1ebebe92d14 (patch) | |
tree | 51ad6b8eb7e087bda2b13af1f8f95315c2b6bc81 | |
parent | 65a7979874054b96a9b5076b7d15479910e2df16 (diff) | |
download | gitbook-234a37726fe895f59f8fc0329ea4d1ebebe92d14.zip gitbook-234a37726fe895f59f8fc0329ea4d1ebebe92d14.tar.gz gitbook-234a37726fe895f59f8fc0329ea4d1ebebe92d14.tar.bz2 |
Improve logs for images and ebook copy
-rw-r--r-- | lib/book.js | 16 | ||||
-rw-r--r-- | lib/utils/page.js | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/book.js b/lib/book.js index dc3594b..064b9fc 100644 --- a/lib/book.js +++ b/lib/book.js @@ -295,14 +295,11 @@ Book.prototype.generateFile = function(output, options) { _tmpDir = path.join(_tmpDir, lang); } - book.log.info("copy ebook to", output, "..."); + book.log.info.ln("copy ebook to", _outputFile); return fs.copy( path.join(_tmpDir, "index."+options.ebookFormat), _outputFile - ) - .then(function() { - book.log.info.ok(); - }); + ); }; // Multi-langs book @@ -313,12 +310,15 @@ Book.prototype.generateFile = function(output, options) { _.map(book.langs, function(lang) { return copyFile(lang.lang); }) - ); + ) + .thenResolve(book.langs.length); } else { - return copyFile(); + return copyFile().thenResolve(1); } }) - .then(function() { + .then(function(n) { + book.log.info.ok(n+" file(s) generated"); + return fs.remove(tmpDir); }); }); diff --git a/lib/utils/page.js b/lib/utils/page.js index f422d4c..f771f72 100644 --- a/lib/utils/page.js +++ b/lib/utils/page.js @@ -218,7 +218,7 @@ function normalizeHtml(src, options) { function convertImages(images, options) { if (!options.convertImages) return Q(); - options.book.log.info.ln("convert ", images.length, "images to png"); + options.book.log.debug.ln("convert ", images.length, "images to png"); return _.reduce(images, function(prev, image) { var imgin = path.resolve(options.book.options.output, image.source); @@ -228,8 +228,8 @@ function convertImages(images, options) { // Write image if need to be download .then(function() { if (!image.origin) return; - options.book.log.info("download image", image.origin); - return options.book.log.info.promise(fs.writeStream(imgin, request(image.origin))); + options.book.log.debug("download image", image.origin, "..."); + return options.book.log.debug.promise(fs.writeStream(imgin, request(image.origin))); }) // Write svg if content @@ -247,7 +247,7 @@ function convertImages(images, options) { }); }, Q()) .then(function() { - options.book.log.info.ok(images.length+" images converted with success"); + options.book.log.debug.ok(images.length+" images converted with success"); }); }; |