log some info on successful file uploads

pull/1/head
ansuz 5 years ago
parent 37d3995ac1
commit d35b015c3f

@ -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);
});
};

Loading…
Cancel
Save