diff --git a/lib/platform/bitbucket/index.js b/lib/platform/bitbucket/index.js index 2d59f527ac..36d54f4b74 100644 --- a/lib/platform/bitbucket/index.js +++ b/lib/platform/bitbucket/index.js @@ -230,7 +230,10 @@ async function getBranchStatus(branchName, requiredStatusChecks) { ); const noOfFailures = statuses.filter(status => status.state === 'FAILED') .length; - logger.debug({ branchName, sha, statuses }, 'branch status check result'); + logger.debug( + { branch: branchName, sha, statuses }, + 'branch status check result' + ); if (noOfFailures) { return 'failed'; } diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index 80a0e44b33..7be628c574 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -422,7 +422,7 @@ function mergeBranch(branchName) { // istanbul ignore if if (config.pushProtection) { logger.info( - { branchName }, + { branch: branchName }, 'Branch protection: Attempting to merge branch when push protection is enabled' ); } @@ -504,7 +504,7 @@ async function setBranchStatus( if (existingStatus === state) { return; } - logger.info({ branchName, context, state }, 'Setting branch status'); + logger.info({ branch: branchName, context, state }, 'Setting branch status'); const branchCommit = await config.storage.getBranchCommit(branchName); const url = `repos/${config.repository}/statuses/${branchCommit}`; const options = { @@ -836,7 +836,7 @@ async function createPr( `repos/${config.parentRepo || config.repository}/pulls`, options )).body; - logger.debug({ branchName, pr: pr.number }, 'PR created'); + logger.debug({ branch: branchName, pr: pr.number }, 'PR created'); pr.displayNumber = `Pull Request #${pr.number}`; pr.branchName = branchName; await addLabels(pr.number, labels); @@ -1200,7 +1200,7 @@ async function mergePr(prNo, branchName) { // istanbul ignore if if (config.pushProtection) { logger.info( - { branchName, prNo }, + { branch: branchName, prNo }, 'Branch protection: Cannot automerge PR when push protection is enabled' ); return false; @@ -1208,7 +1208,7 @@ async function mergePr(prNo, branchName) { // istanbul ignore if if (config.prReviewsRequired) { logger.debug( - { branchName, prNo }, + { branch: branchName, prNo }, 'Branch protection: Attempting to merge PR when PR reviews are enabled' ); const repository = config.parentRepo || config.repository; @@ -1216,7 +1216,7 @@ async function mergePr(prNo, branchName) { const isApproved = reviews.body.some(review => review.state === 'APPROVED'); if (!isApproved) { logger.info( - { branchName, prNo }, + { branch: branchName, prNo }, 'Branch protection: Cannot automerge PR until there is an approving review' ); return false; diff --git a/lib/platform/github/storage.js b/lib/platform/github/storage.js index ea0af7e914..1948a402c2 100644 --- a/lib/platform/github/storage.js +++ b/lib/platform/github/storage.js @@ -148,9 +148,12 @@ class Storage { ); } catch (err) /* istanbul ignore next */ { if (err.message.startsWith('Reference does not exist')) { - logger.info({ branchName }, 'Branch to delete does not exist'); + logger.info( + { branch: branchName }, + 'Branch to delete does not exist' + ); } else { - logger.warn({ err, branchName }, 'Error deleting branch'); + logger.warn({ err, branch: branchName }, 'Error deleting branch'); } } } @@ -167,7 +170,7 @@ class Storage { }; try { await get.patch(url, options); - logger.debug({ branchName }, 'Branch merged'); + logger.debug({ branch: branchName }, 'Branch merged'); } catch (err) { logger.info({ err }, `Error pushing branch merge for ${branchName}`); throw new Error('Branch automerge failed'); @@ -205,7 +208,7 @@ class Storage { } catch (error) { if (error.statusCode === 404) { // If file not found, then return null JSON - logger.info({ filePath, branchName }, 'getFile 404'); + logger.info({ filePath, branch: branchName }, 'getFile 404'); return null; } if ( @@ -281,11 +284,11 @@ class Storage { try { if (isBranchExisting) { await updateBranch(branchName, commit); - logger.debug({ branchName }, 'Branch updated'); + logger.debug({ branch: branchName }, 'Branch updated'); return 'updated'; } await createBranch(branchName, commit); - logger.info({ branchName }, 'Branch created'); + logger.info({ branch: branchName }, 'Branch created'); return 'created'; } catch (err) /* istanbul ignore next */ { logger.debug({ @@ -324,7 +327,7 @@ class Storage { await deleteBranch(blockingBranch); } } - logger.debug({ options, branchName }, 'Creating branch'); + logger.debug({ options, branch: branchName }, 'Creating branch'); await get.post(`repos/${config.repository}/git/refs`, options); branchList.push(branchName); logger.debug('Created branch'); diff --git a/lib/workers/branch/automerge.js b/lib/workers/branch/automerge.js index c57d60d3e2..d01b409120 100644 --- a/lib/workers/branch/automerge.js +++ b/lib/workers/branch/automerge.js @@ -19,7 +19,7 @@ async function tryBranchAutomerge(config) { logger.debug(`Automerging branch`); try { await platform.mergeBranch(config.branchName); - logger.info({ branchName: config.branchName }, 'Branch automerged'); + logger.info({ branch: config.branchName }, 'Branch automerged'); return 'automerged'; // Branch no longer exists } catch (err) { logger.info({ err }, `Failed to automerge branch`); diff --git a/lib/workers/branch/commit.js b/lib/workers/branch/commit.js index 5aceee88ea..8b3de3d328 100644 --- a/lib/workers/branch/commit.js +++ b/lib/workers/branch/commit.js @@ -19,7 +19,7 @@ async function commitFilesToBranch(config) { config.parentBranch || config.baseBranch || undefined ); if (res) { - logger.info({ branchName: config.branchName }, `Branch ${res}`); + logger.info({ branch: config.branchName }, `Branch ${res}`); } } else { logger.debug(`No files to commit`); diff --git a/lib/workers/pr/index.js b/lib/workers/pr/index.js index a7536a5eab..ab7f1b5f6f 100644 --- a/lib/workers/pr/index.js +++ b/lib/workers/pr/index.js @@ -218,7 +218,7 @@ async function ensurePr(prConfig) { ); return existingPr; } - logger.debug({ branchName, prTitle }, `Creating PR`); + logger.debug({ branch: branchName, prTitle }, `Creating PR`); // istanbul ignore if if (config.updateType === 'rollback') { logger.warn('Creating Rollback PR'); @@ -233,16 +233,19 @@ async function ensurePr(prConfig) { false, config.statusCheckVerify ); - logger.info({ branchName, pr: pr.number }, 'PR created'); + logger.info({ branch: branchName, pr: pr.number }, 'PR created'); } catch (err) { logger.warn({ err }, `Failed to create PR`); if (err.message === 'Validation Failed (422)') { - logger.info({ branchName }, 'Deleting invalid branch'); + logger.info({ branch: branchName }, 'Deleting invalid branch'); await platform.deleteBranch(branchName); } // istanbul ignore if if (err.statusCode === 502) { - logger.info({ branchName }, 'Deleting branch due to server error'); + logger.info( + { branch: branchName }, + 'Deleting branch due to server error' + ); await platform.deleteBranch(branchName); } return null; diff --git a/lib/workers/repository/onboarding/branch/config.js b/lib/workers/repository/onboarding/branch/config.js index 0993a7df0a..7b542b1caf 100644 --- a/lib/workers/repository/onboarding/branch/config.js +++ b/lib/workers/repository/onboarding/branch/config.js @@ -21,7 +21,7 @@ async function getOnboardingConfig(config) { renovateJson.labels = [String(label).replace('greenkeeper', 'renovate')]; } if (branchName) { - logger.info({ branchName }, 'Migrating Greenkeeper branchName'); + logger.info({ branch: branchName }, 'Migrating Greenkeeper branchName'); renovateJson.branchName = [ String(branchName).replace('greenkeeper', 'renovate'), ];