Add logging

This commit is contained in:
PJ 2022-02-16 12:41:16 +01:00
parent ebb04e548c
commit 71e0849bb8
No known key found for this signature in database
GPG Key ID: F345964979FA8971
1 changed files with 4 additions and 0 deletions

View File

@ -123,6 +123,7 @@ async function reuploadFile(cid: string, recordsDB: Collection<IRecord>): Promis
// download cid as file
const filePath = `${UPLOAD_PATH}/${cid}.${ext}`;
try {
console.log('starting download')
await download(cid, filePath, isDir);
} catch (error) {
console.log('download error: ', error)
@ -132,7 +133,9 @@ async function reuploadFile(cid: string, recordsDB: Collection<IRecord>): Promis
// upload the file
let skylink;
try {
console.log('starting upload')
skylink = await uploadFile(filePath);
console.log('upload finsihed')
} catch (error) {
console.log('upload error: ', error)
throw error;
@ -143,6 +146,7 @@ async function reuploadFile(cid: string, recordsDB: Collection<IRecord>): Promis
// update record
await recordsDB.updateOne({ cid }, { $set: { skylink } });
console.log('database updated')
return skylink;
}