Skip to content

Commit

Permalink
feat: add log fn
Browse files Browse the repository at this point in the history
  • Loading branch information
yclgkd committed Aug 17, 2023
1 parent f867db2 commit 97f9161
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ interface ConfigOptions {
const { PayloadTooLargeError } = utils.errors;
const { kbytesToBytes, bytesToHumanReadable } = utils.file;

const log = (...args: any) => {
if (process.env.NODE_ENV !== 'production') {
console.debug('>>>>>>> upload cos <<<<<<<');
console.debug(...args);
}
};


export = {
init(config: ConfigOptions) {
const {SecretId, SecretKey, Bucket, Region, ACL = 'default', Expires = 3600} = config
Expand Down Expand Up @@ -68,6 +76,7 @@ export = {
Key
},
function (err) {
log({err})
if (err) return reject(err)
resolve()
}
Expand Down Expand Up @@ -99,6 +108,7 @@ export = {
Protocol: 'https'
},
function (err, data) {
log({err, data})
if (err) return reject(err)
resolve({url: data.Url})
}
Expand Down Expand Up @@ -130,6 +140,7 @@ export = {
ContentType: file.mime,
},
function (err, data) {
log({err, data})
if (err) return reject(err)
file.url = `https://${data.Location}`
file.provider = 'strapi-provider-upload-tencent-cloud-storage'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-tencent-cloud-storage",
"version": "1.0.8",
"version": "1.0.9",
"description": "A integration of Tencent Cloud COS as a file storage solution within Strapi.",
"main": "dist/index.js",
"directories": {
Expand Down

0 comments on commit 97f9161

Please sign in to comment.