Skip to content

Commit

Permalink
[upload-docs] improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Oct 31, 2017
1 parent aa6e031 commit ae043d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medic-configurer-beta",
"version": "1.6.15",
"version": "1.6.16",
"description": "Configure Medic Mobile deployments",
"main": "index.js",
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions src/fn/upload-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = (projectDir, couchUrl) => {
.forEach(validateJson);

const sets = [];
const totalCount = docFiles.length;
while(docFiles.length) {
sets.push(docFiles.slice(0, BATCH_SIZE));
docFiles = docFiles.slice(BATCH_SIZE);
Expand All @@ -45,7 +46,7 @@ module.exports = (projectDir, couchUrl) => {

return db.bulkDocs(docs)
.then(res => {
trace('Uploaded', docSet);
trace(`Processed ${docSet.length} docs.`);
res.forEach(r => {
if(r.error) {
results.failed[r.id] = `${r.error}: ${r.reason}`;
Expand All @@ -59,8 +60,9 @@ module.exports = (projectDir, couchUrl) => {

return process
.then(() => {
info('Upload ok for', results.ok);
const okCount = results.ok.length;
info('Upload failed for:\n' + JSON.stringify(results.failed, null, 2));
info(`Summary: ${okCount} of ${totalCount} docs uploaded OK.`);
});
};

Expand Down

0 comments on commit ae043d4

Please sign in to comment.