mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
Improve logs for images and ebook copy
This commit is contained in:
+8
-8
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
+4
-4
@@ -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");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user