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