diff --git a/lib/plugins/branches.js b/lib/plugins/branches.js index cac0aadf..96e7a98e 100644 --- a/lib/plugins/branches.js +++ b/lib/plugins/branches.js @@ -26,7 +26,7 @@ module.exports = class Branches extends ErrorStash { let p = Object.assign(this.repo, { branch: branch.name }) if (branch.name === 'default') { p = Object.assign(this.repo, { branch: currentRepo.data.default_branch }) - this.log(`Deleting default branch protection for branch ${currentRepo.data.default_branch}`) + this.log.debug(`Deleting default branch protection for branch ${currentRepo.data.default_branch}`) } // Hack to handle closures and keep params from changing const params = Object.assign({}, p) @@ -43,7 +43,7 @@ module.exports = class Branches extends ErrorStash { let p = Object.assign(this.repo, { branch: branch.name }) if (branch.name === 'default') { p = Object.assign(this.repo, { branch: currentRepo.data.default_branch }) - // this.log(`Setting default branch protection for branch ${currentRepo.data.default_branch}`) + // this.log.debug(`Setting default branch protection for branch ${currentRepo.data.default_branch}`) } // Hack to handle closures and keep params from changing const params = Object.assign({}, p) @@ -73,7 +73,7 @@ module.exports = class Branches extends ErrorStash { return Promise.resolve(resArray) } this.log.debug(`Adding branch protection ${JSON.stringify(params)}`) - return this.github.repos.updateBranchProtection(params).then(res => this.log(`Branch protection applied successfully ${JSON.stringify(res.url)}`)).catch(e => { this.logError(`Error applying branch protection ${JSON.stringify(e)}`); return [] }) + return this.github.repos.updateBranchProtection(params).then(res => this.log.debug(`Branch protection applied successfully ${JSON.stringify(res.url)}`)).catch(e => { this.logError(`Error applying branch protection ${JSON.stringify(e)}`); return [] }) }).catch((e) => { if (e.status === 404) { Object.assign(params, branch.protection, { headers: previewHeaders }) @@ -82,7 +82,7 @@ module.exports = class Branches extends ErrorStash { return Promise.resolve(resArray) } this.log.debug(`Adding branch protection ${JSON.stringify(params)}`) - return this.github.repos.updateBranchProtection(params).then(res => this.log(`Branch protection applied successfully ${JSON.stringify(res.url)}`)).catch(e => { this.logError(`Error applying branch protection ${JSON.stringify(e)}`); return [] }) + return this.github.repos.updateBranchProtection(params).then(res => this.log.debug(`Branch protection applied successfully ${JSON.stringify(res.url)}`)).catch(e => { this.logError(`Error applying branch protection ${JSON.stringify(e)}`); return [] }) } else { this.logError(e) if (this.nop) { diff --git a/lib/plugins/rulesets.js b/lib/plugins/rulesets.js index 029e12c3..ee5525c8 100644 --- a/lib/plugins/rulesets.js +++ b/lib/plugins/rulesets.js @@ -26,7 +26,7 @@ module.exports = class Rulesets extends Diffable { org: this.repo.owner, headers: version }) - this.log(listOptions) + this.log.debug(listOptions) return this.github.paginate(listOptions) .then(res => { const rulesets = res.map(ruleset => { @@ -55,7 +55,7 @@ module.exports = class Rulesets extends Diffable { repo: this.repo.repo, headers: version }) - this.log(listOptions) + this.log.debug(listOptions) return this.github.paginate(listOptions) .then(res => { const rulesets = res @@ -102,7 +102,7 @@ module.exports = class Rulesets extends Diffable { } this.log.debug(`Updating Ruleset with the following values ${JSON.stringify(parms, null, 2)}`) return this.github.request('PUT /orgs/{org}/rulesets/{id}', parms).then(res => { - this.log(`Ruleset updated successfully ${JSON.stringify(res.url)}`) + this.log.debug(`Ruleset updated successfully ${JSON.stringify(res.url)}`) return res }).catch(e => { return this.handleError(e) @@ -115,7 +115,7 @@ module.exports = class Rulesets extends Diffable { } this.log.debug(`Updating Ruleset with the following values ${JSON.stringify(parms, null, 2)}`) return this.github.request('PUT /repos/{owner}/{repo}/rulesets/{id}', parms).then(res => { - this.log(`Ruleset updated successfully ${JSON.stringify(res.url)}`) + this.log.debug(`Ruleset updated successfully ${JSON.stringify(res.url)}`) return res }).catch(e => { return this.handleError(e) @@ -132,7 +132,7 @@ module.exports = class Rulesets extends Diffable { } this.log.debug(`Creating Rulesets with the following values ${JSON.stringify(attrs, null, 2)}`) return this.github.request('POST /orgs/{org}/rulesets', this.wrapAttrs(attrs)).then(res => { - this.log(`Ruleset created successfully ${JSON.stringify(res.url)}`) + this.log.debug(`Ruleset created successfully ${JSON.stringify(res.url)}`) return res }).catch(e => { return this.handleError(e) @@ -145,7 +145,7 @@ module.exports = class Rulesets extends Diffable { } this.log.debug(`Creating Rulesets with the following values ${JSON.stringify(attrs, null, 2)}`) return this.github.request('POST /repos/{owner}/{repo}/rulesets', this.wrapAttrs(attrs)).then(res => { - this.log(`Ruleset created successfully ${JSON.stringify(res.url)}`) + this.log.debug(`Ruleset created successfully ${JSON.stringify(res.url)}`) return res }).catch(e => { return this.handleError(e) @@ -163,7 +163,7 @@ module.exports = class Rulesets extends Diffable { } this.log.debug(`Deleting Ruleset with the following values ${JSON.stringify(parms, null, 2)}`) return this.github.request('DELETE /orgs/{org}/rulesets/{id}', parms).then(res => { - this.log(`Ruleset deleted successfully ${JSON.stringify(res.url)}`) + this.log.debug(`Ruleset deleted successfully ${JSON.stringify(res.url)}`) return res }).catch(e => { return this.handleError(e) @@ -176,7 +176,7 @@ module.exports = class Rulesets extends Diffable { } this.log.debug(`Deleting Ruleset with the following values ${JSON.stringify(parms, null, 2)}`) return this.github.request('DELETE /repos/{owner}/{repo}/rulesets/{id}', parms).then(res => { - this.log(`Ruleset deleted successfully ${JSON.stringify(res.url)}`) + this.log.debug(`Ruleset deleted successfully ${JSON.stringify(res.url)}`) return res }).catch(e => { if (e.status === 404) { diff --git a/lib/plugins/validator.js b/lib/plugins/validator.js index 45f04d60..8ee72af9 100644 --- a/lib/plugins/validator.js +++ b/lib/plugins/validator.js @@ -20,7 +20,7 @@ module.exports = class Validator { } }).then(res => { if (this.repo.repo.search(this.regex) >= 0) { - this.log(`Repo ${this.repo.repo} Passed Validation for pattern ${this.pattern}`) + this.log.debug(`Repo ${this.repo.repo} Passed Validation for pattern ${this.pattern}`) if (this.nop) { return Promise.resolve([ new NopCommand(this.constructor.name, this.repo, null, `Passed Validation for pattern ${this.pattern}`) @@ -38,7 +38,7 @@ module.exports = class Validator { }) } } else { - this.log(`Repo ${this.repo.repo} Failed Validation for pattern ${this.pattern}`) + this.log.debug(`Repo ${this.repo.repo} Failed Validation for pattern ${this.pattern}`) if (this.nop) { return Promise.resolve([ new NopCommand(this.constructor.name, this.repo, null, `Failed Validation for pattern ${this.pattern}`, 'ERROR') @@ -59,7 +59,7 @@ module.exports = class Validator { }) .catch(() => {}) } catch (error) { - this.log(`Error in Validation checking ${error}`) + this.log.debug(`Error in Validation checking ${error}`) } } }