Skip to content

Commit 5553ddc

Browse files
committed
fix: change console.debug to console.log
1 parent baa0892 commit 5553ddc

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

src/baas/apigw/index.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ class Apigw {
150150
})
151151
if (detail && detail.apiId) {
152152
exist = true
153-
console.debug(`Updating api with api id ${endpoint.apiId}.`)
153+
console.log(`Updating api with api id ${endpoint.apiId}.`)
154154
await this.request({
155155
Action: 'ModifyApi',
156156
apiId: endpoint.apiId,
157157
...apiInputs
158158
})
159159
output.apiId = endpoint.apiId
160-
console.debug(`Service with id ${output.apiId} updated.`)
160+
console.log(`Service with id ${output.apiId} updated.`)
161161
}
162162
} catch (e) {}
163163
}
@@ -168,7 +168,7 @@ class Apigw {
168168
})
169169
output.apiId = apiId
170170
output.created = true
171-
console.debug(`API with id ${output.apiId} created.`)
171+
console.log(`API with id ${output.apiId} created.`)
172172
}
173173

174174
const { internalDomain } = await this.request({
@@ -188,13 +188,13 @@ class Apigw {
188188
}
189189

190190
if (secretIds.length === 0) {
191-
console.debug(`Creating a new Secret key.`)
191+
console.log(`Creating a new Secret key.`)
192192
const { secretId, secretKey } = await this.request({
193193
Action: 'CreateApiKey',
194194
secretName: secretName,
195195
type: 'auto'
196196
})
197-
console.debug(`Secret key with ID ${secretId} and key ${secretKey} updated.`)
197+
console.log(`Secret key with ID ${secretId} and key ${secretKey} updated.`)
198198
secretIdsOutput.secretIds = [secretId]
199199
secretIdsOutput.created = true
200200
} else {
@@ -219,14 +219,14 @@ class Apigw {
219219
found = true
220220
} else {
221221
disable = true
222-
console.debug(`There is a disabled secret key: ${secretId}, cannot be bound`)
222+
console.log(`There is a disabled secret key: ${secretId}, cannot be bound`)
223223
}
224224
break
225225
}
226226
}
227227
if (!found) {
228228
if (!disable) {
229-
console.debug(`Secret key id ${secretId} does't exist`)
229+
console.log(`Secret key id ${secretId} does't exist`)
230230
}
231231
} else {
232232
ids.push(secretId)
@@ -258,9 +258,9 @@ class Apigw {
258258
})
259259
usagePlanOutput.id = createUsagePlan.usagePlanId
260260
usagePlanOutput.created = true
261-
console.debug(`Usage plan with ID ${usagePlanOutput.id} created.`)
261+
console.log(`Usage plan with ID ${usagePlanOutput.id} created.`)
262262
} else {
263-
console.debug(`Updating usage plan with id ${usagePlan.usagePlanId}.`)
263+
console.log(`Updating usage plan with id ${usagePlan.usagePlanId}.`)
264264
await this.request({
265265
Action: 'ModifyUsagePlan',
266266
usagePlanId: usagePlanOutput.id,
@@ -320,7 +320,7 @@ class Apigw {
320320
for (let j = 0; j < stateDomains.length; j++) {
321321
// only list subDomain and created in state
322322
if (stateDomains[j].subDomain === domainItem.domainName) {
323-
console.debug(
323+
console.log(
324324
`Start unbind previus domain ${domainItem.domainName} for service ${serviceId}`
325325
)
326326
await this.request({
@@ -335,7 +335,7 @@ class Apigw {
335335
// 2. bind user config domain
336336
const customDomainOutput = []
337337
if (customDomains && customDomains.length > 0) {
338-
console.debug(`Start bind custom domain for service ${serviceId}`)
338+
console.log(`Start bind custom domain for service ${serviceId}`)
339339
for (let i = 0; i < customDomains.length; i++) {
340340
const domainItem = customDomains[i]
341341
const domainProtocol = domainItem.protocols
@@ -358,8 +358,8 @@ class Apigw {
358358
subDomain: domainItem.domain,
359359
cname: subDomain
360360
})
361-
console.debug(`Custom domain for service ${serviceId} created successfullly.`)
362-
console.debug(`Please add CNAME record ${subDomain} for ${domainItem.domain}.`)
361+
console.log(`Custom domain for service ${serviceId} created successfullly.`)
362+
console.log(`Please add CNAME record ${subDomain} for ${domainItem.domain}.`)
363363
}
364364
}
365365

@@ -383,11 +383,11 @@ class Apigw {
383383

384384
const oldUsagePlan = usagePlanList.find((item) => item.usagePlanId === usagePlan.id)
385385
if (oldUsagePlan) {
386-
console.debug(
386+
console.log(
387387
`Usage plan with id ${usagePlan.id} already bind to api id ${apiId} path ${endpoint.method} ${endpoint.path}.`
388388
)
389389
} else {
390-
console.debug(
390+
console.log(
391391
`Binding usage plan with id ${usagePlan.id} to api id ${apiId} path ${endpoint.method} ${endpoint.path}.`
392392
)
393393
await this.request({
@@ -398,7 +398,7 @@ class Apigw {
398398
usagePlanIds: [usagePlan.id],
399399
apiIds: [apiId]
400400
})
401-
console.debug('Binding successed.')
401+
console.log('Binding successed.')
402402
}
403403
}
404404

@@ -455,15 +455,15 @@ class Apigw {
455455
secretIds: secrets.secretIds
456456
})
457457
if (unboundSecretIds.length > 0) {
458-
console.debug(
458+
console.log(
459459
`Binding secret key ${unboundSecretIds} to usage plan with id ${usagePlan.id}.`
460460
)
461461
await this.request({
462462
Action: 'BindSecretIds',
463463
usagePlanId: usagePlan.id,
464464
secretIds: unboundSecretIds
465465
})
466-
console.debug('Binding secret key successed.')
466+
console.log('Binding secret key successed.')
467467
}
468468
// store in api list
469469
curApi.usagePlan.secrets = secrets
@@ -480,12 +480,12 @@ class Apigw {
480480
}
481481

482482
apiList.push(curApi)
483-
console.debug(
483+
console.log(
484484
`Deployment successful for the api named ${endpoint.apiName} in the ${this.region} region.`
485485
)
486486
}
487487

488-
console.debug(`Deploying service with id ${serviceId}.`)
488+
console.log(`Deploying service with id ${serviceId}.`)
489489
await this.request({
490490
Action: 'ReleaseService',
491491
serviceId: serviceId,
@@ -532,7 +532,7 @@ class Apigw {
532532
secretIds: secrets.secretIds,
533533
usagePlanId: curApi.usagePlan.id
534534
})
535-
console.debug(`Unbinding secret key to usage plan with ID ${curApi.usagePlan.id}.`)
535+
console.log(`Unbinding secret key to usage plan with ID ${curApi.usagePlan.id}.`)
536536

537537
// delelet all created api key
538538
if (curApi.usagePlan.secrets.created === true) {
@@ -546,7 +546,7 @@ class Apigw {
546546
Action: 'DeleteApiKey',
547547
secretId
548548
})
549-
console.debug(`Removing any previously deployed secret key. ${secretId}`)
549+
console.log(`Removing any previously deployed secret key. ${secretId}`)
550550
}
551551
}
552552
}
@@ -560,13 +560,13 @@ class Apigw {
560560
bindType: curApi.bindType,
561561
apiIds: [curApi.apiId]
562562
})
563-
console.debug(
563+
console.log(
564564
`Unbinding usage plan with ID ${curApi.usagePlan.id} to service with ID ${serviceId}.`
565565
)
566566

567567
// 1.3 delete created usage plan
568568
if (curApi.usagePlan.created === true) {
569-
console.debug(`Removing any previously deployed usage plan ids ${curApi.usagePlan.id}`)
569+
console.log(`Removing any previously deployed usage plan ids ${curApi.usagePlan.id}`)
570570
await this.request({
571571
Action: 'DeleteUsagePlan',
572572
usagePlanId: curApi.usagePlan.id
@@ -576,7 +576,7 @@ class Apigw {
576576

577577
// 2. delete only apis created by serverless framework
578578
if (curApi.apiId && curApi.created === true) {
579-
console.debug(`Removing api: ${curApi.apiId}`)
579+
console.log(`Removing api: ${curApi.apiId}`)
580580
await this.request({
581581
Action: 'DeleteApi',
582582
apiId: curApi.apiId,
@@ -590,7 +590,7 @@ class Apigw {
590590
for (let i = 0; i < customDomains.length; i++) {
591591
const curDomain = customDomains[i]
592592
if (curDomain.subDomain && curDomain.created === true) {
593-
console.debug(`Unbinding custom domain: ${curDomain.subDomain}`)
593+
console.log(`Unbinding custom domain: ${curDomain.subDomain}`)
594594
await this.request({
595595
Action: 'UnBindSubDomain',
596596
serviceId,
@@ -601,7 +601,7 @@ class Apigw {
601601
}
602602

603603
// 3. unrelease service
604-
console.debug(`Unreleasing service: ${serviceId}, environment: ${environment}`)
604+
console.log(`Unreleasing service: ${serviceId}, environment: ${environment}`)
605605
await this.request({
606606
Action: 'UnReleaseService',
607607
serviceId,
@@ -611,7 +611,7 @@ class Apigw {
611611

612612
if (created === true) {
613613
// delete service
614-
console.debug(`Removing service: ${serviceId}`)
614+
console.log(`Removing service: ${serviceId}`)
615615
await this.request({
616616
Action: 'DeleteService',
617617
serviceId

src/baas/cdn/index.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,19 @@ class Cdn {
7777
const createOrUpdateCdn = async () => {
7878
if (cdnInfo) {
7979
// update
80-
console.debug(`The CDN domain ${host} has existed.`)
81-
console.debug('Updating...')
80+
console.log(`The CDN domain ${host} has existed.`)
81+
console.log('Updating...')
8282
cdnInputs.hostId = cdnInfo.id
8383
await UpdateCdnConfig(capi, cdnInputs)
8484
outputs.hostId = cdnInfo.id
8585
} else {
8686
// create
87-
console.debug(`Adding CDN domain ${host}...`)
87+
console.log(`Adding CDN domain ${host}...`)
8888
try {
8989
await AddCdnHost(capi, cdnInputs)
9090
} catch (e) {
9191
if (e.code === 9111) {
92-
console.debug(`Please goto https://console.cloud.tencent.com/cdn open CDN service.`)
92+
console.log(`Please goto https://console.cloud.tencent.com/cdn open CDN service.`)
9393
}
9494
}
9595
const { id } = await getCdnByHost(capi, host)
@@ -98,19 +98,19 @@ class Cdn {
9898
}
9999

100100
// state=4: deploying status, we can not do any operation
101-
console.debug('Waiting for CDN deploy success...')
101+
console.log('Waiting for CDN deploy success...')
102102
await waitResponse({
103103
callback: async () => getCdnByHost(capi, host),
104104
targetProp: 'status',
105105
targetResponse: 5,
106106
timeout: TIMEOUT
107107
})
108-
console.debug(`CDN deploy success to host: ${host}`)
108+
console.log(`CDN deploy success to host: ${host}`)
109109
}
110110

111111
const creatOrUpdateHttps = async () => {
112112
if (https) {
113-
console.debug(`Setup https for ${host}...`)
113+
console.log(`Setup https for ${host}...`)
114114
// update https
115115
const httpsInputs = {
116116
host: host,
@@ -131,7 +131,7 @@ class Cdn {
131131
await SetHttpsInfo(capi, httpsInputs)
132132
outputs.https = true
133133
} else {
134-
console.debug(`Removing https for ${host}...`)
134+
console.log(`Removing https for ${host}...`)
135135
// delete https
136136
const httpsInputs = {
137137
host: host,
@@ -151,14 +151,14 @@ class Cdn {
151151
// pass state for cache check
152152
const { inputCache } = oldState
153153
if (inputCache && inputCache.base === JSON.stringify(sourceBaseConf)) {
154-
console.debug(`No base configuration changes for CDN domain ${host}`)
154+
console.log(`No base configuration changes for CDN domain ${host}`)
155155
outputs.hostId = cdnInfo.id
156156
} else {
157157
await createOrUpdateCdn()
158158
}
159159

160160
if (inputCache && inputCache.https === JSON.stringify(sourceHttpsConf)) {
161-
console.debug(`No https configuration changes for CDN domain ${host}`)
161+
console.log(`No https configuration changes for CDN domain ${host}`)
162162
outputs.https = !!sourceHttpsConf
163163
} else {
164164
await creatOrUpdateHttps()
@@ -180,15 +180,15 @@ class Cdn {
180180
}
181181

182182
// need circle for deleting, after host status is 6, then we can delete it
183-
console.debug(`Start removing CDN for ${host}`)
183+
console.log(`Start removing CDN for ${host}`)
184184
const { status } = await getCdnByHost(capi, host)
185185
// status=5: online
186186
// state=4: deploying
187187
// state=6: offline
188188
if (status === 5) {
189189
// disable first
190190
await OfflineHost(capi, { host: host })
191-
console.debug(`Waiting for offline ${host}...`)
191+
console.log(`Waiting for offline ${host}...`)
192192
await waitResponse({
193193
callback: async () => getCdnByHost(capi, host),
194194
targetProp: 'status',
@@ -198,9 +198,9 @@ class Cdn {
198198
} else if (status === 4) {
199199
throw new Error(`Status is not operational for ${host}`)
200200
}
201-
console.debug(`Removing CDN for ${host}`)
201+
console.log(`Removing CDN for ${host}`)
202202
await DeleteCdnHost(capi, { host: host })
203-
console.debug(`Removed CDN for ${host}.`)
203+
console.log(`Removed CDN for ${host}.`)
204204
return {}
205205
}
206206
}

0 commit comments

Comments
 (0)