diff --git a/lib/index.ts b/lib/index.ts index ee75134..344a0ca 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -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 @@ -68,6 +76,7 @@ export = { Key }, function (err) { + log({err}) if (err) return reject(err) resolve() } @@ -99,6 +108,7 @@ export = { Protocol: 'https' }, function (err, data) { + log({err, data}) if (err) return reject(err) resolve({url: data.Url}) } @@ -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' diff --git a/package.json b/package.json index b01b001..1e93e31 100644 --- a/package.json +++ b/package.json @@ -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": {