diff --git a/lib/commands/upload.js b/lib/commands/upload.js index c64368949..7286caa93 100644 --- a/lib/commands/upload.js +++ b/lib/commands/upload.js @@ -75,8 +75,21 @@ Upload.upload = function (Env, safeKey, chunk, cb) { Env.blobStore.upload(safeKey, chunk, cb); }; +var reportStatus = function (Env, label, safeKey, err, id) { + var data = { + safeKey: safeKey, + err: err && err.message || err, + id: id, + }; + var method = err? 'error': 'info'; + Env.Log[method](label, data); +}; + Upload.complete = function (Env, safeKey, arg, cb) { - Env.blobStore.complete(safeKey, arg, cb); + Env.blobStore.complete(safeKey, arg, function (err, id) { + reportStatus(Env, 'UPLOAD_COMPLETE', safeKey, err, id); + cb(err, id); + }); }; Upload.cancel = function (Env, safeKey, arg, cb) { @@ -84,6 +97,9 @@ Upload.cancel = function (Env, safeKey, arg, cb) { }; Upload.complete_owned = function (Env, safeKey, arg, cb) { - Env.blobStore.completeOwned(safeKey, arg, cb); + Env.blobStore.completeOwned(safeKey, arg, function (err, id) { + reportStatus(Env, 'UPLOAD_COMPLETE_OWNED', safeKey, err, id); + cb(err, id); + }); };